From: Lennart Poettering Date: Wed, 17 Jan 2018 10:13:46 +0000 (+0100) Subject: path-util: do something useful if the prefix is "" in path_make_absolute() X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e3e2901e3cb94b69312bf8b708f8b2683bf2784f;p=elogind.git path-util: do something useful if the prefix is "" in path_make_absolute() Do not insert a "/" if the prefix we shall use is empty. It's a corner case we should probably take care of. --- diff --git a/src/basic/path-util.c b/src/basic/path-util.c index e3c7622da..a04454726 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -82,7 +82,7 @@ char *path_make_absolute(const char *p, const char *prefix) { /* Makes every item in the list an absolute path by prepending * the prefix, if specified and necessary */ - if (path_is_absolute(p) || !prefix) + if (path_is_absolute(p) || isempty(prefix)) return strdup(p); return strjoin(prefix, "/", p); @@ -891,9 +891,9 @@ int systemd_installation_has_version(const char *root, unsigned minimal_version) * for Gentoo which does a merge without making /lib a symlink. */ "lib/systemd/libsystemd-shared-*.so\0" - "lib64/elogind/libelogind-shared-*.so\0" - "usr/lib/elogind/libelogind-shared-*.so\0" - "usr/lib64/elogind/libelogind-shared-*.so\0") { + "lib64/systemd/libsystemd-shared-*.so\0" + "usr/lib/systemd/libsystemd-shared-*.so\0" + "usr/lib64/systemd/libsystemd-shared-*.so\0") { _cleanup_strv_free_ char **names = NULL; _cleanup_free_ char *path = NULL;