From 1be5e6f808e3908ecd13ab68b3fea0739794f02d Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 20 Nov 2017 16:54:04 +0100 Subject: 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 Signed-off-by: Pablo Neira Ayuso --- src/main.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index ff7878c9..353b87bc 100644 --- a/src/main.c +++ b/src/main.c @@ -173,7 +173,6 @@ int main(int argc, char * const *argv) int i, val, rc; nft = nft_ctx_new(NFT_CTX_DEFAULT); - nft_ctx_set_output(nft, stdout); while (1) { val = getopt_long(argc, argv, OPTSTRING, options, NULL); -- cgit v1.2.3