From b19d239323dd9f732b24ad6c95101cf7a51c4b20 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 17 Sep 2019 17:53:31 +0200 Subject: xtables_error() does not return It's a define which resolves into a callback which in turn is declared with noreturn attribute. It will never return, therefore drop all explicit exit() calls or other dead code immediately following it. Signed-off-by: Phil Sutter Acked-by: Florian Westphal --- iptables/iptables-xml.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'iptables/iptables-xml.c') diff --git a/iptables/iptables-xml.c b/iptables/iptables-xml.c index 9d9ce6d4..36ad7845 100644 --- a/iptables/iptables-xml.c +++ b/iptables/iptables-xml.c @@ -208,12 +208,11 @@ needChain(char *chain) static void saveChain(char *chain, char *policy, struct xt_counters *ctr) { - if (nextChain >= maxChains) { + if (nextChain >= maxChains) xtables_error(PARAMETER_PROBLEM, "%s: line %u chain name invalid\n", prog_name, line); - exit(1); - }; + chains[nextChain].chain = strdup(chain); chains[nextChain].policy = strdup(policy); chains[nextChain].count = *ctr; @@ -606,12 +605,11 @@ iptables_xml_main(int argc, char *argv[]) table = strtok(buffer + 1, " \t\n"); DEBUGP("line %u, table '%s'\n", line, table); - if (!table) { + if (!table) xtables_error(PARAMETER_PROBLEM, "%s: line %u table name invalid\n", prog_name, line); - exit(1); - } + openTable(table); ret = 1; @@ -623,23 +621,19 @@ iptables_xml_main(int argc, char *argv[]) chain = strtok(buffer + 1, " \t\n"); DEBUGP("line %u, chain '%s'\n", line, chain); - if (!chain) { + if (!chain) xtables_error(PARAMETER_PROBLEM, "%s: line %u chain name invalid\n", prog_name, line); - exit(1); - } DEBUGP("Creating new chain '%s'\n", chain); policy = strtok(NULL, " \t\n"); DEBUGP("line %u, policy '%s'\n", line, policy); - if (!policy) { + if (!policy) xtables_error(PARAMETER_PROBLEM, "%s: line %u policy invalid\n", prog_name, line); - exit(1); - } ctrs = strtok(NULL, " \t\n"); parse_counters(ctrs, &count); @@ -735,13 +729,11 @@ iptables_xml_main(int argc, char *argv[]) param_buffer[1] != '-' && strchr(param_buffer, 't')) || (!strncmp(param_buffer, "--t", 3) && - !strncmp(param_buffer, "--table", strlen(param_buffer)))) { + !strncmp(param_buffer, "--table", strlen(param_buffer)))) xtables_error(PARAMETER_PROBLEM, "Line %u seems to have a " "-t table option.\n", line); - exit(1); - } add_argv(param_buffer, quoted); if (newargc >= 2 -- cgit v1.2.3