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,7 +84,10 @@ char *path_make_absolute(const char *p, const char *prefix) {
|
||||
if (path_is_absolute(p) || isempty(prefix))
|
||||
return strdup(p);
|
||||
|
||||
return strjoin(prefix, "/", p);
|
||||
if (endswith(prefix, "/"))
|
||||
return strjoin(prefix, p);
|
||||
else
|
||||
return strjoin(prefix, "/", p);
|
||||
}
|
||||
|
||||
int path_make_absolute_cwd(const char *p, char **ret) {
|
||||
|
Loading…
Reference in New Issue
Block a user