From 7aeeb313ad35ff82eee67b568866e95cf22725c2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 17 Jan 2018 11:17:55 +0100 Subject: [PATCH] path-util: don't insert duplicate "/" in path_make_absolute_cwd() When the working directory is "/" it's prettier not to insert a second "/" in the path, even though it is technically correct. --- src/basic/path-util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 666f48cfc33..df946293858 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -127,7 +127,10 @@ int path_make_absolute_cwd(const char *p, char **ret) { if (r < 0) return r; - c = strjoin(cwd, "/", p); + if (endswith(cwd, "/")) + c = strjoin(cwd, p); + else + c = strjoin(cwd, "/", p); } if (!c) return -ENOMEM;