]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
nft: Fix command name in ip6tables error message
authorPhil Sutter <phil@nwl.cc>
Fri, 7 Aug 2020 11:48:28 +0000 (13:48 +0200)
committerPhil Sutter <phil@nwl.cc>
Fri, 14 Aug 2020 07:00:08 +0000 (09:00 +0200)
Upon errors, ip6tables-nft would prefix its error messages with
'iptables:' instead of 'ip6tables:'. Turns out the command name was
hard-coded, use 'progname' variable instead.
While being at it, merge the two mostly identical fprintf() calls into
one.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/xtables-standalone.c

index dd6fb7919d2e18292fbc49ab8a04a5b1af9e2cbe..7b71db62f1ea6b3df9a5544f87e1e253d700e187 100644 (file)
@@ -75,14 +75,10 @@ xtables_main(int family, const char *progname, int argc, char *argv[])
        xtables_fini();
 
        if (!ret) {
-               if (errno == EINVAL) {
-                       fprintf(stderr, "iptables: %s. "
-                                       "Run `dmesg' for more information.\n",
-                               nft_strerror(errno));
-               } else {
-                       fprintf(stderr, "iptables: %s.\n",
-                               nft_strerror(errno));
-               }
+               fprintf(stderr, "%s: %s.%s\n", progname, nft_strerror(errno),
+                       (errno == EINVAL ?
+                        " Run `dmesg' for more information." : ""));
+
                if (errno == EAGAIN)
                        exit(RESOURCE_PROBLEM);
        }