[PATCH 5/5] batctl: debug: don't return negative error codes from handle_debug_table
Sven Eckelmann <[email protected]> Sat, 04 Jul 2026 21:36:03 +0200
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <[email protected]> |
handle_debug_table() returns the result of the netlink dump function directly. This is a negative errno code on failure and main() passes it straight to exit(). The process then terminates with a mangled exit status like 161 (-95 & 0xff). Limit the return codes to EXIT_SUCCESS and EXIT_FAILURE. Signed-off-by: Sven Eckelmann <[email protected]> --- debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debug.c b/debug.c index 22cbcb8..13a0a43 100644 --- a/debug.c +++ b/debug.c @@ -152,5 +152,8 @@ int handle_debug_table(struct state *state, int argc, char **argv) err = debug_table->netlink_fn(state, orig_iface, read_opt, orig_timeout, watch_interval); - return err; + if (err < 0) + return EXIT_FAILURE; + + return EXIT_SUCCESS; } -- 2.47.3