]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
chase: drop wrong optimization
authorLennart Poettering <lennart@amutable.com>
Wed, 25 Feb 2026 11:51:29 +0000 (12:51 +0100)
committerLennart Poettering <lennart@amutable.com>
Tue, 3 Mar 2026 07:48:01 +0000 (08:48 +0100)
The same optimization is already applied in the very similar
dir_fd_is_root() check a few lines up – with the exception that it
doesn't accept AT_FCWD there. And frankly turning off
CHASE_AT_RESOLVE_IN_ROOT if we operate on AT_FCWD is simply wrong. Hence
remove this code.

src/basic/chase.c

index 6e8cc15f2efe7de8d843b104744081ec309ae4ad..8030c74079666d72cfa8b41924cd07d709e73f59 100644 (file)
@@ -277,15 +277,6 @@ int chaseat(int dir_fd, const char *path, ChaseFlags flags, char **ret_path, int
 
                 dir_fd = _dir_fd;
                 flags &= ~CHASE_AT_RESOLVE_IN_ROOT;
-        } else if (FLAGS_SET(flags, CHASE_AT_RESOLVE_IN_ROOT)) {
-                /* If we get AT_FDCWD or dir_fd points to "/", then we always resolve symlinks relative to
-                 * the host's root. Hence, CHASE_AT_RESOLVE_IN_ROOT is meaningless. */
-
-                r = dir_fd_is_root_or_cwd(dir_fd);
-                if (r < 0)
-                        return r;
-                if (r > 0)
-                        flags &= ~CHASE_AT_RESOLVE_IN_ROOT;
         }
 
         if (!ret_path && ret_fd && (flags & (CHASE_AT_RESOLVE_IN_ROOT|CHASE_NO_SHORTCUT_MASK)) == 0) {