Do not print to pipe or close command if nothing was executed
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 21 May 2013 14:43:56 +0000 (16:43 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 21 May 2013 14:43:56 +0000 (16:43 +0200)
includes.c
ipsets.c

index 42d5b7a856dee6afeb1098c6a5402c48af95bff5..5022fbd71882a13b7f41dfb3c52e91110534f73a 100644 (file)
@@ -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();
 }
 
 
index e149b5baa6ef24d0a49d7b28f492d10174bcfb1e..d33873a249fce4b7d9d4b222b25e5415fc34f220 100644 (file)
--- 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)