From 5231faea0fd5f5d4538a99d8234103a8297ff82f Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sat, 9 Mar 2013 01:01:11 +0100 Subject: xtables: fix missing xtables_exit_error definition iptables_exit_error is defined in iptables/iptables.c, that symbol cannot be used by iptables/xtables.c Signed-off-by: Pablo Neira Ayuso --- iptables/xtables.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'iptables/xtables.c') diff --git a/iptables/xtables.c b/iptables/xtables.c index c0a6347a..abc2379d 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -114,13 +114,13 @@ static struct option original_opts[] = { {NULL}, }; -void iptables_exit_error(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3))); +void xtables_exit_error(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3))); struct xtables_globals xtables_globals = { .option_offset = 0, .program_version = IPTABLES_VERSION, .orig_opts = original_opts, - .exit_err = iptables_exit_error, + .exit_err = xtables_exit_error, .compat_rev = nft_compatible_revision, }; @@ -295,6 +295,26 @@ exit_printhelp(const struct xtables_rule_match *matches) exit(0); } +void +xtables_exit_error(enum xtables_exittype status, const char *msg, ...) +{ + va_list args; + + va_start(args, msg); + fprintf(stderr, "%s v%s: ", prog_name, prog_vers); + vfprintf(stderr, msg, args); + va_end(args); + fprintf(stderr, "\n"); + if (status == PARAMETER_PROBLEM) + exit_tryhelp(status); + if (status == VERSION_PROBLEM) + fprintf(stderr, + "Perhaps iptables or your kernel needs to be upgraded.\n"); + /* On error paths, make sure that we don't leak memory */ + xtables_free_opts(1); + exit(status); +} + static void generic_opt_check(int command, int options) { -- cgit v1.2.3