chiark / gitweb /
path-util: do something useful if the prefix is "" in path_make_absolute()
authorLennart Poettering <lennart@poettering.net>
Wed, 17 Jan 2018 10:13:46 +0000 (11:13 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:50:10 +0000 (07:50 +0200)
Do not insert a "/" if the prefix we shall use is empty. It's a corner
case we should probably take care of.

src/basic/path-util.c

index e3c7622da107766dead2b5debb43d23e8dd7d026..a044547263722d67d495e6e040e113a4d876f011 100644 (file)
@@ -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;