summaryrefslogtreecommitdiff
path: root/src/shared/path-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-12-15 23:01:05 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-12-16 00:30:34 -0500
commitbc854dc7cd051e1e5a6ebcca8084b07168051c6c (patch)
tree6281cc6f6a9adf4e6f67b1f8660031156ddf6fe4 /src/shared/path-util.c
parentad2a035820e0fca29e49816f735bec1fcdabf82a (diff)
systemctl: refuse to edit runtime dropins when they already exist in /etc
The check for existing unit files and dropins is unified. path_join() is updated to not insert duplicate separators.
Diffstat (limited to 'src/shared/path-util.c')
-rw-r--r--src/shared/path-util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index b3fe0b817..dcc8321f5 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -439,14 +439,14 @@ char* path_join(const char *root, const char *path, const char *rest) {
assert(path);
if (!isempty(root))
- return strjoin(root, "/",
+ return strjoin(root, endswith(root, "/") ? "" : "/",
path[0] == '/' ? path+1 : path,
- rest ? "/" : NULL,
+ rest ? (endswith(path, "/") ? "" : "/") : NULL,
rest && rest[0] == '/' ? rest+1 : rest,
NULL);
else
return strjoin(path,
- rest ? "/" : NULL,
+ rest ? (endswith(path, "/") ? "" : "/") : NULL,
rest && rest[0] == '/' ? rest+1 : rest,
NULL);
}