summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-08 17:15:06 +0100
committerLennart Poettering <lennart@poettering.net>2016-12-20 20:00:08 +0100
commit245f1d244b3a91e7cc18ed2d21226292251b934d (patch)
tree196b04d8d105ca47052178a8a28f6f70403b8727
parentdee22f39707699d3cd8a3bb9cde4ce85486fbebd (diff)
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.
-rw-r--r--src/basic/fs-util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
index 5b23269109..e31fa2711a 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;
}