]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
recurse-dir: use fd_reopen() at one more place
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Sep 2022 11:39:29 +0000 (13:39 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 20 Sep 2022 15:55:23 +0000 (00:55 +0900)
Inspired by 83b94cf10e4f76b2b415bc70bf65f1c28698b97c

src/basic/recurse-dir.c

index efa1797b7bab73816adee78858c546a1fbf24ca8..d16ca98f67a1785e4aa6d1c7bcdd9e5e91dde584 100644 (file)
@@ -255,9 +255,9 @@ int recurse_dir(
                                          * directory fd — which should be riskless now that we pinned the
                                          * inode. */
 
-                                        subdir_fd = openat(AT_FDCWD, FORMAT_PROC_FD_PATH(inode_fd), O_DIRECTORY|O_CLOEXEC);
+                                        subdir_fd = fd_reopen(inode_fd, O_DIRECTORY|O_CLOEXEC);
                                         if (subdir_fd < 0)
-                                                return -errno;
+                                                return subdir_fd;
 
                                         inode_fd = safe_close(inode_fd);
                                 }