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.
This commit is contained in:
Lennart Poettering 2016-12-08 17:15:06 +01:00
parent dee22f3970
commit 245f1d244b
1 changed files with 4 additions and 2 deletions

View 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;
}