systemd-path: return accumulated error instead of last result

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>
This commit is contained in:
anthisfan
2025-09-15 00:04:47 +09:00
committed by Mike Yuan
parent a0203ac14c
commit 778e95420a

View 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) {