1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

chase-symlinks: fix shortcut condition

This commit is contained in:
Lennart Poettering 2022-08-22 11:35:43 +02:00
parent 6957023208
commit 37b9bc56fc

View File

@ -505,7 +505,7 @@ int chase_symlinks_and_stat(
if (chase_flags & CHASE_NONEXISTENT)
return -EINVAL;
if (empty_or_root(root) && !ret_path && (chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE)) == 0) {
if (empty_or_root(root) && !ret_path && (chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE)) == 0 && !ret_fd) {
/* Shortcut this call if none of the special features of this call are requested */
if (fstatat(AT_FDCWD, path, ret_stat, FLAGS_SET(chase_flags, CHASE_NOFOLLOW) ? AT_SYMLINK_NOFOLLOW : 0) < 0)