summaryrefslogtreecommitdiffstats
path: root/iptables/iptables-restore.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-09-17 17:53:31 +0200
committerPhil Sutter <phil@nwl.cc>2019-09-25 23:46:14 +0200
commitb19d239323dd9f732b24ad6c95101cf7a51c4b20 (patch)
tree9c335bdce9d382cd4599ad082624a80d31e44499 /iptables/iptables-restore.c
parent7c64eaf4b1b97ff69a7d9c5c13d4e9eff97d2cd1 (diff)
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 <phil@nwl.cc> Acked-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/iptables-restore.c')
-rw-r--r--iptables/iptables-restore.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/iptables/iptables-restore.c b/iptables/iptables-restore.c
index 430be18b..6bc182bf 100644
--- a/iptables/iptables-restore.c
+++ b/iptables/iptables-restore.c
@@ -82,11 +82,10 @@ create_handle(struct iptables_restore_cb *cb, const char *tablename)
handle = cb->ops->init(tablename);
}
- if (!handle) {
+ if (!handle)
xtables_error(PARAMETER_PROBLEM, "%s: unable to initialize "
"table '%s'\n", xt_params->program_name, tablename);
- exit(1);
- }
+
return handle;
}
@@ -207,12 +206,11 @@ ip46tables_restore_main(struct iptables_restore_cb *cb, 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",
xt_params->program_name, line);
- exit(1);
- }
+
strncpy(curtable, table, XT_TABLE_MAXNAMELEN);
curtable[XT_TABLE_MAXNAMELEN] = '\0';
@@ -248,12 +246,10 @@ ip46tables_restore_main(struct iptables_restore_cb *cb, 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",
xt_params->program_name, line);
- exit(1);
- }
if (strlen(chain) >= XT_EXTENSION_MAXNAMELEN)
xtables_error(PARAMETER_PROBLEM,
@@ -281,12 +277,10 @@ ip46tables_restore_main(struct iptables_restore_cb *cb, int argc, char *argv[])
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",
xt_params->program_name, line);
- exit(1);
- }
if (strcmp(policy, "-") != 0) {
struct xt_counters count = {};