]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
recurse-dir: use -EBADF as placeholder for invalid fd
authorMike Yuan <me@yhndnzj.com>
Wed, 9 Jul 2025 07:35:40 +0000 (09:35 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 9 Jul 2025 08:13:59 +0000 (10:13 +0200)
As per our coding style.

src/basic/recurse-dir.c

index 508076207804e9ef2d3e0529e260c18166ffa761..05a2cfa2e0639cb5470e5a760c195ca0c6a8e539 100644 (file)
@@ -175,7 +175,7 @@ int recurse_dir(
 
                 r = func(RECURSE_DIR_ENTER,
                          path,
-                         -1, /* we have no parent fd */
+                         -EBADF, /* we have no parent fd */
                          dir_fd,
                          NULL, /* we have no dirent */
                          statx_mask != 0 ? &root_sx : NULL,
@@ -229,9 +229,9 @@ int recurse_dir(
                                         r = func(RECURSE_DIR_SKIP_OPEN_DIR_ERROR_BASE + errno,
                                                  p,
                                                  dir_fd,
-                                                 -1,
+                                                 /* inode_fd = */ -EBADF,
                                                  de->entries[i],
-                                                 NULL,
+                                                 /* sx = */ NULL,
                                                  userdata);
                                         if (r == RECURSE_DIR_LEAVE_DIRECTORY)
                                                 break;
@@ -273,9 +273,9 @@ int recurse_dir(
                                         r = func(RECURSE_DIR_SKIP_OPEN_INODE_ERROR_BASE + errno,
                                                  p,
                                                  dir_fd,
-                                                 -1,
+                                                 /* inode_fd = */ -EBADF,
                                                  de->entries[i],
-                                                 NULL,
+                                                 /* sx = */ NULL,
                                                  userdata);
                                         if (r == RECURSE_DIR_LEAVE_DIRECTORY)
                                                 break;
@@ -321,9 +321,9 @@ int recurse_dir(
                                         r = func(RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE + errno,
                                                  p,
                                                  dir_fd,
-                                                 -1,
+                                                 /* inode_fd = */ -EBADF,
                                                  de->entries[i],
-                                                 NULL,
+                                                 /* sx = */ NULL,
                                                  userdata);
                                         if (r == RECURSE_DIR_LEAVE_DIRECTORY)
                                                 break;
@@ -351,9 +351,9 @@ int recurse_dir(
                                         r = func(RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE + EISDIR,
                                                  p,
                                                  dir_fd,
-                                                 -1,
+                                                 /* inode_fd = */ -EBADF,
                                                  de->entries[i],
-                                                 NULL,
+                                                 /* sx = */ NULL,
                                                  userdata);
                                         if (r == RECURSE_DIR_LEAVE_DIRECTORY)
                                                 break;
@@ -476,9 +476,9 @@ int recurse_dir(
 
                 r = func(RECURSE_DIR_LEAVE,
                          path,
-                         -1,
+                         -EBADF, /* we have no parent fd */
                          dir_fd,
-                         NULL,
+                         NULL, /* we have no dirent */
                          statx_mask != 0 ? &root_sx : NULL,
                          userdata);
                 if (!IN_SET(r, RECURSE_DIR_LEAVE_DIRECTORY, RECURSE_DIR_SKIP_ENTRY, RECURSE_DIR_CONTINUE))