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

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