]> 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)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 4 Mar 2025 21:28:53 +0000 (21:28 +0000)
Fixes a bug in b5a07e524e42d2594174ca1a5b72aa4fdb9af94c (v250).

(cherry picked from commit 91421f8379b66316f937d56c60c2e782b7a79eca)

src/basic/recurse-dir.c

index 378fd92b06175a1f16973de12135d30b5a23539e..f5848e52fe528b20127911ffb82fa71af804ade0 100644 (file)
@@ -321,7 +321,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,
@@ -351,7 +351,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,