diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-01-17 11:17:55 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-01-17 11:17:55 +0100 |
commit | 7aeeb313ad35ff82eee67b568866e95cf22725c2 (patch) | |
tree | 3e8520294852f1c8cf6096b6789c25f50e76a769 /src/basic/path-util.c | |
parent | d72495759b0f953b86f16669bf8120ede28836a5 (diff) | |
download | systemd-7aeeb313ad35ff82eee67b568866e95cf22725c2.tar.gz |
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.
Diffstat (limited to 'src/basic/path-util.c')
-rw-r--r-- | src/basic/path-util.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 666f48cfc3..df94629385 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; |