Blame SOURCES/0041-nft-Fix-command-name-in-ip6tables-error-message.patch

b144b7
From 6d8a390bd13bac294ff9de225a49fe9e4de2d6e5 Mon Sep 17 00:00:00 2001
b144b7
From: Phil Sutter <phil@nwl.cc>
b144b7
Date: Fri, 7 Aug 2020 13:48:28 +0200
b144b7
Subject: [PATCH] nft: Fix command name in ip6tables error message
b144b7
b144b7
Upon errors, ip6tables-nft would prefix its error messages with
b144b7
'iptables:' instead of 'ip6tables:'. Turns out the command name was
b144b7
hard-coded, use 'progname' variable instead.
b144b7
While being at it, merge the two mostly identical fprintf() calls into
b144b7
one.
b144b7
b144b7
Signed-off-by: Phil Sutter <phil@nwl.cc>
b144b7
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
b144b7
(cherry picked from commit 3be40dcfb5af1438b6abdbda45a1e3b59c104e13)
b144b7
Signed-off-by: Phil Sutter <psutter@redhat.com>
b144b7
---
b144b7
 iptables/xtables-standalone.c | 12 ++++--------
b144b7
 1 file changed, 4 insertions(+), 8 deletions(-)
b144b7
b144b7
diff --git a/iptables/xtables-standalone.c b/iptables/xtables-standalone.c
b144b7
index 022d5dd44abbf..b5b7ccaf4e660 100644
b144b7
--- a/iptables/xtables-standalone.c
b144b7
+++ b/iptables/xtables-standalone.c
b144b7
@@ -74,14 +74,10 @@ xtables_main(int family, const char *progname, int argc, char *argv[])
b144b7
 	nft_fini(&h);
b144b7
 
b144b7
 	if (!ret) {
b144b7
-		if (errno == EINVAL) {
b144b7
-			fprintf(stderr, "iptables: %s. "
b144b7
-					"Run `dmesg' for more information.\n",
b144b7
-				nft_strerror(errno));
b144b7
-		} else {
b144b7
-			fprintf(stderr, "iptables: %s.\n",
b144b7
-				nft_strerror(errno));
b144b7
-		}
b144b7
+		fprintf(stderr, "%s: %s.%s\n", progname, nft_strerror(errno),
b144b7
+			(errno == EINVAL ?
b144b7
+			 " Run `dmesg' for more information." : ""));
b144b7
+
b144b7
 		if (errno == EAGAIN)
b144b7
 			exit(RESOURCE_PROBLEM);
b144b7
 	}
b144b7
-- 
b144b7
2.28.0
b144b7