]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
util-lib: accept invoking chase_symlinks() with a NULL return parameter
authorLennart Poettering <lennart@poettering.net>
Thu, 8 Dec 2016 16:15:06 +0000 (17:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Dec 2016 19:00:08 +0000 (20:00 +0100)
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

index 5b232691090acbb405d7ba137d56d6652af05a32..e31fa2711a436245f795fbe8984ed9b86b552e3d 100644 (file)
@@ -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;
 }