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 42d5b7a..5022fbd 100644 (file)
@@ -135,7 +135,8 @@ fw3_print_includes(struct fw3_state *state, enum fw3_family family, bool reload)
                print_include(include);
        }
 
                print_include(include);
        }
 
-       fw3_command_close();
+       if (exec)
+               fw3_command_close();
 }
 
 
 }
 
 
index e149b5b..d33873a 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("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)
 
        /* wait for ipsets to disappear */
        list_for_each_entry(ipset, &state->ipsets, list)