From af5aaf31592dc0e25351e366235b355aa1ab6eee Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 21 May 2013 16:43:56 +0200 Subject: [PATCH] Do not print to pipe or close command if nothing was executed --- includes.c | 3 ++- ipsets.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/includes.c b/includes.c index 42d5b7a..5022fbd 100644 --- a/includes.c +++ b/includes.c @@ -135,7 +135,8 @@ fw3_print_includes(struct fw3_state *state, enum fw3_family family, bool reload) print_include(include); } - fw3_command_close(); + if (exec) + fw3_command_close(); } diff --git a/ipsets.c b/ipsets.c index e149b5b..d33873a 100644 --- a/ipsets.c +++ b/ipsets.c @@ -384,8 +384,11 @@ fw3_destroy_ipsets(struct fw3_state *state) fw3_pr("destroy %s\n", ipset->name); } - fw3_pr("quit\n"); - fw3_command_close(); + if (exec) + { + fw3_pr("quit\n"); + fw3_command_close(); + } /* wait for ipsets to disappear */ list_for_each_entry(ipset, &state->ipsets, list) -- 2.25.1