]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
main: Drop stdout hack to expose nft_print() implementation issues
authorPhil Sutter <phil@nwl.cc>
Fri, 29 Sep 2017 11:26:22 +0000 (13:26 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 29 Sep 2017 11:27:46 +0000 (13:27 +0200)
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/main.c

index 6d2422ffeccf943f0a0cff07354b7216ecb6c6a3..fc79cfaa30e0c31b8bfd228d3b9c8e06da168dbf 100644 (file)
@@ -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);