]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Make iptables-restore usable over a pipe
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Mon, 12 May 2008 18:51:45 +0000 (20:51 +0200)
committerPatrick McHardy <kaber@trash.net>
Mon, 12 May 2008 18:51:45 +0000 (20:51 +0200)
The attached patch flushes stdout between commands to make output
operations (-L etc) in iptables-restore usable over a pipe. stdio by
defaut buffers output if not connected to a terminal.

Henrik Nordstrom <henrik@henriknordstrom.net>

ip6tables-restore.c
iptables-restore.c

index 6e41d510da69a155d7479527cb5b890df67f9ae7..9f6108a21ebf60e6ba5efd6f7d437074b6fee6b2 100644 (file)
@@ -436,6 +436,7 @@ int main(int argc, char *argv[])
                                         &newargv[2], &handle);
 
                        free_argv();
+                       fflush(stdout);
                }
                if (!ret) {
                        fprintf(stderr, "%s: line %u failed\n",
index ee3ba45591b4510e765c00767e55acd4d3e2fdb2..879683c54921114a727ebdb0bb3caf830e3f18bd 100644 (file)
@@ -442,6 +442,7 @@ main(int argc, char *argv[])
                                         &newargv[2], &handle);
 
                        free_argv();
+                       fflush(stdout);
                }
                if (tablename && (strcmp(tablename, curtable) != 0))
                        continue;