]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
chase: extend coverage of the root fd shortcut
authorLennart Poettering <lennart@poettering.net>
Fri, 16 Jan 2026 16:55:47 +0000 (17:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 17 Jan 2026 11:37:39 +0000 (12:37 +0100)
Let's use dir_fd_is_root() to check if we are looking at the real root
fs.

src/basic/chase.c

index 323e46237543f058d0a32c115990238832b4cca5..f360cc26a3c882079ac634c279e0e15d3795266d 100644 (file)
@@ -220,7 +220,10 @@ int chaseat(int dir_fd, const char *path, ChaseFlags flags, char **ret_path, int
          */
 
         _cleanup_close_ int _dir_fd = -EBADF;
-        if (dir_fd == XAT_FDROOT) {
+        r = dir_fd_is_root(dir_fd);
+        if (r < 0)
+                return r;
+        if (r > 0) {
 
                 /* Shortcut the common case where no root dir is specified, and no special flags are given to
                  * a regular open() */