netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
To: netfilter-devel@vger.kernel.org
Cc: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Subject: [iptables-nftables - PATCH] xtables: Do not dump before command parsing has been finished
Date: Wed, 31 Jul 2013 15:18:52 +0300	[thread overview]
Message-ID: <1375273132-10169-1-git-send-email-tomasz.bursztyka@linux.intel.com> (raw)

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


             reply	other threads:[~2013-07-31 12:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 12:18 Tomasz Bursztyka [this message]
2013-07-31 17:12 ` [iptables-nftables - PATCH] xtables: Do not dump before command parsing has been finished Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375273132-10169-1-git-send-email-tomasz.bursztyka@linux.intel.com \
    --to=tomasz.bursztyka@linux.intel.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).