summaryrefslogtreecommitdiff
path: root/src/basic/path-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-01-17 11:17:55 +0100
committerLennart Poettering <lennart@poettering.net>2018-01-17 11:17:55 +0100
commit7aeeb313ad35ff82eee67b568866e95cf22725c2 (patch)
tree3e8520294852f1c8cf6096b6789c25f50e76a769 /src/basic/path-util.c
parentd72495759b0f953b86f16669bf8120ede28836a5 (diff)
downloadsystemd-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.c5
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;