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)
committerLennart Poettering <lennart@poettering.net>
Wed, 17 Jan 2018 10:14:28 +0000 (11:14 +0100)
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 ab4778d..b877bdc 100644 (file)
@@ -81,7 +81,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);