]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
ebtables: Use xtables_exit_err()
authorPhil Sutter <phil@nwl.cc>
Fri, 23 Nov 2018 14:32:53 +0000 (15:32 +0100)
committerFlorian Westphal <fw@strlen.de>
Fri, 23 Nov 2018 14:53:38 +0000 (15:53 +0100)
When e.g. ebtables-nft detects an incompatible table, a stray '.' was
printed as last line of output:

| # ebtables-nft -L
| table `filter' is incompatible, use 'nft' tool.
| .

This comes from ebtables' own exit_err callback. Instead use the common
one which also provides useful version information.

While being at it, align the final error message in xtables_eb_main()
with how the others print it.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/xtables-eb-standalone.c
iptables/xtables-eb.c

index 84ce0b60a7076e118c4184cdb8acc4bb7501a68b..fb3daba0bd604008b56f04f61952eaa7eaa4005c 100644 (file)
@@ -54,7 +54,7 @@ int xtables_eb_main(int argc, char *argv[])
                ret = nft_commit(&h);
 
        if (!ret)
-               fprintf(stderr, "%s\n", nft_strerror(errno));
+               fprintf(stderr, "ebtables: %s\n", nft_strerror(errno));
 
        exit(!ret);
 }
index 871891442e4318989075b6afdfa638c8b81f1a96..16d874120c0bb647b44c5c3764c9f1304144fb8f 100644 (file)
@@ -291,23 +291,12 @@ struct option ebt_original_options[] =
        { 0 }
 };
 
-static void __attribute__((__noreturn__,format(printf,2,3)))
-ebt_print_error(enum xtables_exittype status, const char *format, ...)
-{
-       va_list l;
-
-       va_start(l, format);
-       vfprintf(stderr, format, l);
-       fprintf(stderr, ".\n");
-       va_end(l);
-       exit(-1);
-}
-
+extern void xtables_exit_error(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3)));
 struct xtables_globals ebtables_globals = {
        .option_offset          = 0,
        .program_version        = IPTABLES_VERSION,
        .orig_opts              = ebt_original_options,
-       .exit_err               = ebt_print_error,
+       .exit_err               = xtables_exit_error,
        .compat_rev             = nft_compatible_revision,
 };