]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
recurse-dir: fix wrong assertion and error code in log
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 28 Feb 2025 11:22:42 +0000 (20:22 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 28 Feb 2025 14:37:52 +0000 (23:37 +0900)
Fixes a bug in b5a07e524e42d2594174ca1a5b72aa4fdb9af94c (v250).

src/basic/recurse-dir.c

index 3d6061cfc0f91cde4d2fb0453d671a08c5b59455..4ff55032cc894abafb50dfb77b791740f6e0027c 100644 (file)
@@ -317,7 +317,7 @@ int recurse_dir(
                                 if (r < 0) {
                                         log_debug_errno(r, "Failed to stat directory entry '%s': %m", p);
 
-                                        assert(errno <= RECURSE_DIR_SKIP_STAT_INODE_ERROR_MAX - RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE);
+                                        assert(-r <= RECURSE_DIR_SKIP_STAT_INODE_ERROR_MAX - RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE);
 
                                         r = func(RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE + -r,
                                                  p,
@@ -347,7 +347,7 @@ int recurse_dir(
                                          * guarantee that RECURSE_DIR_ENTRY is strictly issued for
                                          * non-directory dirents. */
 
-                                        log_debug_errno(r, "Non-directory entry '%s' suddenly became a directory: %m", p);
+                                        log_debug("Non-directory entry '%s' suddenly became a directory.", p);
 
                                         r = func(RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE + EISDIR,
                                                  p,