From: Lennart Poettering Date: Wed, 4 Oct 2017 15:34:03 +0000 (+0200) Subject: fs-util: small tweak in chase_symlinks() X-Git-Tag: v236~280^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8c4a8ea2ac2569eb9f376ad17f8baea3e836b8ba;p=thirdparty%2Fsystemd.git fs-util: small tweak in chase_symlinks() If we follow an absolute symlink there's no need to prefix the path with a "/", since by definition it already has one. This helps suppressing double "/" in resolved paths containing absolute symlinks. --- diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index b90f343ed39..946f779a329 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -766,12 +766,11 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags, return -ENOMEM; } - } - - /* Prefix what's left to do with what we just read, and start the loop again, - * but remain in the current directory. */ - - joined = strjoin("/", destination, todo); + /* Prefix what's left to do with what we just read, and start the loop again, but + * remain in the current directory. */ + joined = strjoin(destination, todo); + } else + joined = strjoin("/", destination, todo); if (!joined) return -ENOMEM;