]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemd-path: return accumulated error instead of last result
authoranthisfan <gtpgx305@gmail.com>
Sun, 14 Sep 2025 15:04:47 +0000 (00:04 +0900)
committerMike Yuan <me@yhndnzj.com>
Sun, 14 Sep 2025 20:18:19 +0000 (22:18 +0200)
Because it returns the result of the final sd_path_lookup() call rather than the return value of RET_GATHER,
it appears that it may return success even if an error occurs during processing.

With this patch, errors encountered during the loop will be properly tallied and returned, and failures will not be silently ignored.

Signed-off-by: anthisfan <gtpgx305@gmail.com>
src/path/path-tool.c

index 41d0ba861cc72e0de794297c4fa6d23a0d13d686..3dc31832b38cba9ed31b8755981ad5ab53b285d9 100644 (file)
@@ -146,7 +146,7 @@ static int list_paths(void) {
                 printf("%s%s:%s %s\n", ansi_highlight(), t, ansi_normal(), p);
         }
 
-        return r;
+        return ret;
 }
 
 static int print_path(const char *n) {