From: Lennart Poettering Date: Wed, 17 Jan 2018 10:17:55 +0000 (+0100) Subject: path-util: don't insert duplicate "/" in path_make_absolute_cwd() X-Git-Tag: v237~86^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7aeeb313ad35ff82eee67b568866e95cf22725c2;p=thirdparty%2Fsystemd.git 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. --- 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;