]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
chase-symlinks: fix shortcut condition
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Aug 2022 09:35:43 +0000 (11:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 22 Aug 2022 11:40:13 +0000 (13:40 +0200)
src/basic/chase-symlinks.c

index ab80e766885802349ae47efd5537ec28297e2f20..2561da0e8c1d6abb142b3a7ff3a4d9acdf3e7bb2 100644 (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)