]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: fd_get_path() already understands AT_FDCWD natively
authorLennart Poettering <lennart@poettering.net>
Mon, 9 Dec 2024 11:48:07 +0000 (12:48 +0100)
committerMike Yuan <me@yhndnzj.com>
Tue, 10 Dec 2024 19:46:30 +0000 (20:46 +0100)
src/shared/discover-image.c
src/shared/selinux-util.c

index 10b2405cc37a05b60ea006b209651ddfb4cbf045..82e0ad4c027238ac0a384ab6a4fcd1cf0b40f423 100644 (file)
@@ -351,12 +351,8 @@ static int image_make(
                 st = &stbuf;
         }
 
-        if (!path) {
-                if (dfd == AT_FDCWD)
-                        (void) safe_getcwd(&parent);
-                else
-                        (void) fd_get_path(dfd, &parent);
-        }
+        if (!path)
+                (void) fd_get_path(dfd, &parent);
 
         read_only =
                 (path && path_startswith(path, "/usr")) ||
index 4d3b127d8e9a50b1f192e214c138d7d0308270a5..ff49e219a0b92a2a74b05f7dc7e1b2425143cfbf 100644 (file)
@@ -584,10 +584,7 @@ int mac_selinux_create_file_prepare_at(
                 return 0;
 
         if (isempty(path) || !path_is_absolute(path)) {
-                if (dir_fd == AT_FDCWD)
-                        r = safe_getcwd(&abspath);
-                else
-                        r = fd_get_path(dir_fd, &abspath);
+                r = fd_get_path(dir_fd, &abspath);
                 if (r < 0)
                         return r;