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.
This commit is contained in:
Lennart Poettering
2018-01-17 11:17:55 +01:00
parent d72495759b
commit 7aeeb313ad

View File

@@ -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;