All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven@narfation.org>
Subject: [PATCH 5/5] batctl: debug: don't return negative error codes from handle_debug_table
Date: Sat, 04 Jul 2026 21:36:03 +0200	[thread overview]
Message-ID: <20260704-bugfixes-debug-v1-5-888ddc878206@narfation.org> (raw)
In-Reply-To: <20260704-bugfixes-debug-v1-0-888ddc878206@narfation.org>

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 <sven@narfation.org>
---
 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


      parent reply	other threads:[~2026-07-04 19:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 19:35 [PATCH 0/5] batctl: debug tables bugfixes Sven Eckelmann
2026-07-04 19:35 ` [PATCH 1/5] batctl: debug: avoid endless getopt loop for attached '-w' argument Sven Eckelmann
2026-07-04 19:36 ` [PATCH 2/5] batctl: debug: use strict interval/timeout parsing Sven Eckelmann
2026-07-04 19:36 ` [PATCH 3/5] batctl: debug: reject trailing garbage for intervals Sven Eckelmann
2026-07-04 19:36 ` [PATCH 4/5] batctl: debug: reject non-finite/negative interval/timeout values Sven Eckelmann
2026-07-04 19:36 ` Sven Eckelmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260704-bugfixes-debug-v1-5-888ddc878206@narfation.org \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.