From bc854dc7cd051e1e5a6ebcca8084b07168051c6c Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Mon, 15 Dec 2014 23:01:05 -0500 Subject: 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. --- src/shared/path-util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/shared/path-util.c') diff --git a/src/shared/path-util.c b/src/shared/path-util.c index b3fe0b8179..dcc8321f50 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); } -- cgit v1.2.3-54-g00ecf