mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 09:56:51 +03:00
path-util: don't add extra "/" when prefix already is suffixed by slash
No need to insert duplicate "/" if we can avoid it. This is particularly relevant if the prefix passed in is the root directory.
This commit is contained in:
parent
81cce8ded5
commit
cddd2ce106
@ -84,6 +84,9 @@ char *path_make_absolute(const char *p, const char *prefix) {
|
||||
if (path_is_absolute(p) || isempty(prefix))
|
||||
return strdup(p);
|
||||
|
||||
if (endswith(prefix, "/"))
|
||||
return strjoin(prefix, p);
|
||||
else
|
||||
return strjoin(prefix, "/", p);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user