From: Lennart Poettering Date: Thu, 8 Dec 2016 16:15:06 +0000 (+0100) Subject: util-lib: accept invoking chase_symlinks() with a NULL return parameter X-Git-Tag: v233~237^2~42 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=245f1d244b3a91e7cc18ed2d21226292251b934d;p=thirdparty%2Fsystemd.git util-lib: accept invoking chase_symlinks() with a NULL return parameter Let's permit invoking chase_symlinks() with a NULL return parameter. If so, the resolved name is not returned, and call is useful for checking for existance of a file, without actually returning its ultimate path. --- diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 5b232691090..e31fa2711a4 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -799,8 +799,10 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags, return -ENOMEM; } - *ret = done; - done = NULL; + if (ret) { + *ret = done; + done = NULL; + } return exists; }