netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iptables-nftables - PATCH] xtables: Do not dump before command parsing has been finished
@ 2013-07-31 12:18 Tomasz Bursztyka
  2013-07-31 17:12 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Bursztyka @ 2013-07-31 12:18 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Tomasz Bursztyka

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

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
---

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(-)

diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c
index db03090..990c0fe 100644
--- a/iptables/xtables-save.c
+++ b/iptables/xtables-save.c
@@ -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);
 }
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [iptables-nftables - PATCH] xtables: Do not dump before command parsing has been finished
  2013-07-31 12:18 [iptables-nftables - PATCH] xtables: Do not dump before command parsing has been finished Tomasz Bursztyka
@ 2013-07-31 17:12 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2013-07-31 17:12 UTC (permalink / raw)
  To: Tomasz Bursztyka; +Cc: netfilter-devel

On Wed, Jul 31, 2013 at 03:18:52PM +0300, Tomasz Bursztyka wrote:
> On xtables-save.c, -d will not output right away but after the full
> command line hase been parsed.

Applied, thanks Tomasz.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-31 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31 12:18 [iptables-nftables - PATCH] xtables: Do not dump before command parsing has been finished Tomasz Bursztyka
2013-07-31 17:12 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).