Skip to contentSkip to conversation

xtables: Do not dump before command parsing has been finished

PATCH Applied Tomasz Bursztyka 2 participants 2 messages Jul 31, 2013 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xtables: Do not dump before command parsing has been finished

On xtables-save.c, -d will not output right away but after the full command line hase been parsed.

---

I ensure the same behavior as usual, so -d outputs and exit succesfully as usual.

 iptables/xtables-save.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
iptables/xtables-save.c +8 -2
index db03090..990c0fe 100644
@@ -78,6 +78,7 @@ int
 xtables_save_main(int argc, char *argv[])
 {
 	const char *tablename = NULL;
+	bool dump = false;
 	struct nft_handle h = {
 		.family	= AF_INET,	/* default to AF_INET */
 	};
@@ -118,8 +119,8 @@ xtables_save_main(int argc, char *argv[])
 			xtables_modprobe_program = optarg;
 			break;
 		case 'd':
-			do_output(&h, tablename, show_counters);
-			exit(0);
+			dump = true;
+			break;
 		case '4':
 			h.family = AF_INET;
 			break;
@@ -135,5 +136,10 @@ xtables_save_main(int argc, char *argv[])
 		exit(1);
 	}
 
+	if (dump) {
+		do_output(&h, tablename, show_counters);
+		exit(0);
+	}
+
 	return !do_output(&h, tablename, show_counters);
 }
Signature · 1 line
1.8.3.2
maintainer Applied
#1 lore raw
Quoted 2 lines · Tomasz Bursztyka

On xtables-save.c, -d will not output right away but after the full command line hase been parsed.

Applied, thanks Tomasz.