From: Zbigniew Jędrzejewski-Szmek Date: Wed, 9 May 2018 23:55:05 +0000 (+0200) Subject: basic/fs-util: remove logically dead code X-Git-Tag: v239~287^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=027cc9c92eb92ff89aacc22c9a131e7988b72e72;p=thirdparty%2Fsystemd.git basic/fs-util: remove logically dead code We can jump to chase_one from two places. In the first 'todo' is set to 'buffer', which comes from path_make_absolute_cwd() and is nonnull In the second 'todo' is set to 'joined' which is checked to be nonull a few lines above the jump. So let's kill the code that deals with null todo there. CID #1390941. --- diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 13dccfef545..232a21c1930 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -919,25 +919,12 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags, return exists; chased_one: - if (ret) { char *c; - if (done) { - if (todo) { - c = strjoin(done, todo); - if (!c) - return -ENOMEM; - } else - c = TAKE_PTR(done); - } else { - if (todo) - c = strdup(todo); - else - c = strdup("/"); - if (!c) - return -ENOMEM; - } + c = strjoin(strempty(done), todo); + if (!c) + return -ENOMEM; *ret = c; }