summaryrefslogtreecommitdiffstats
path: root/iptables-save.c
diff options
context:
space:
mode:
authorJamal Hadi Salim <hadi@cyberus.ca>2009-02-13 09:14:17 -0500
committerJan Engelhardt <jengelh@medozas.de>2009-02-13 15:46:52 +0100
commit7e4db2f50133007f549f222468bde4f3adcf41ac (patch)
tree161425eb53b09d37cc86f961fdb1760548b8e338 /iptables-save.c
parent70581922f873a88306dd5b1cb83c5081ee239eb8 (diff)
libxtables: consolidate init calls into one function
Introduce xtables_init_all() which hides three calls xtables_init(), xtables_set_nfproto(), and xtables_set_params(). Make ip[6]tables-restore, ip[6]tables-save and ip[6]tables-standalone use it. I moved xtables_set_params around for readability reasons. Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Diffstat (limited to 'iptables-save.c')
-rw-r--r--iptables-save.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/iptables-save.c b/iptables-save.c
index 396406fe..312673ac 100644
--- a/iptables-save.c
+++ b/iptables-save.c
@@ -140,9 +140,14 @@ main(int argc, char *argv[])
program_version = IPTABLES_VERSION;
xtables_program_name = program_name;
- xtables_init();
- xtables_set_nfproto(NFPROTO_IPV4);
iptables_globals.program_name = "iptables-save";
+ c = xtables_init_all(&iptables_globals, NFPROTO_IPV4);
+ if (c < 0) {
+ fprintf(stderr, "%s/%s Failed to initialize xtables\n",
+ iptables_globals.program_name,
+ iptables_globals.program_version);
+ exit(1);
+ }
#ifdef NO_SHARED_LIBS
init_extensions();
#endif