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-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=cfd51ef3e72fc5d0651dae32f79ccab69bab9569;p=elogind.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 c483d0471..c350bc85e 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -129,7 +129,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;