1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00

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.
This commit is contained in:
Lennart Poettering 2018-01-17 11:13:46 +01:00
parent 5caf49360b
commit 81cce8ded5

View 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);