]> git.ipfire.org Git - thirdparty/nftables.git/commit
libnftables: Ensure output_fp is never NULL
authorPhil Sutter <phil@nwl.cc>
Mon, 20 Nov 2017 15:54:04 +0000 (16:54 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 22 Nov 2017 12:18:34 +0000 (13:18 +0100)
commit1be5e6f808e3908ecd13ab68b3fea0739794f02d
tree1ea3cc4470d41229a04662536746fd6b95773753
parentf7828416525122914ccb2fa3b5bf2230fbce9c7d
libnftables: Ensure output_fp is never NULL

Initialize output_fp to 'stdout' upon context creation and check output
stream validity in nft_ctx_set_output(). This allows to drop checks in
nft_{gmp_,}print() and do_command_export(). While doing so for the
latter, simplify it a bit by using nft_print() which takes care of
flushing the output stream.

If applications desire to drop all output, they are supposed to open
/dev/null and assign that.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/libnftables.c
src/main.c
src/rule.c