netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Eric Leblond <eric@regit.org>,
	Florian Westphal <fw@strlen.de>
Subject: [nft PATCH 2/2] main: Drop stdout hack to expose nft_print() implementation issues
Date: Fri, 29 Sep 2017 13:26:22 +0200	[thread overview]
Message-ID: <20170929112622.11686-3-phil@nwl.cc> (raw)
In-Reply-To: <20170929112622.11686-1-phil@nwl.cc>

This was helpful when testing nft_print() implementation, but breaks
'nft --help' output. Also, with this in place typical printf-debugging
would have to use stderr at all times which is confusing at least.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 6d2422ffeccf9..fc79cfaa30e0c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -415,11 +415,9 @@ int main(int argc, char * const *argv)
 	bool interactive = false;
 	struct parser_state state;
 	int i, val, rc;
-	FILE *outfp = fdopen(dup(STDOUT_FILENO), "w");
 
 	nft = nft_ctx_new(NFT_CTX_DEFAULT);
-	nft_ctx_set_output(nft, outfp);
-	close(STDOUT_FILENO);
+	nft_ctx_set_output(nft, stdout);
 
 	while (1) {
 		val = getopt_long(argc, argv, OPTSTRING, options, NULL);
-- 
2.13.1


  parent reply	other threads:[~2017-09-29 11:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29 11:26 [nft PATCH 0/2] Follow-up on nft_print() enhancement Phil Sutter
2017-09-29 11:26 ` [nft PATCH 1/2] main: Flush output from nft_gmp_print() Phil Sutter
2017-09-29 11:26 ` Phil Sutter [this message]
2017-09-29 11:27 ` [nft PATCH 0/2] Follow-up on nft_print() enhancement 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=20170929112622.11686-3-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=eric@regit.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).