From c7a64b3cac7ac3db89bbe0b9b1e826cd65e44b5d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 8 Dec 2016 17:15:06 +0100 Subject: 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. --- src/basic/fs-util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/basic/fs-util.c') diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 4d494650c..471708bbe 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -813,8 +813,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; } -- cgit v1.2.3