From: Henrik Nordstrom Date: Mon, 12 May 2008 18:51:45 +0000 (+0200) Subject: Make iptables-restore usable over a pipe X-Git-Tag: v1.4.1-rc1~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d213760d4ffb5d2c45e024783741b4b191b91a74;p=thirdparty%2Fiptables.git Make iptables-restore usable over a pipe 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 --- diff --git a/ip6tables-restore.c b/ip6tables-restore.c index 6e41d510..9f6108a2 100644 --- a/ip6tables-restore.c +++ b/ip6tables-restore.c @@ -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", diff --git a/iptables-restore.c b/iptables-restore.c index ee3ba455..879683c5 100644 --- a/iptables-restore.c +++ b/iptables-restore.c @@ -442,6 +442,7 @@ main(int argc, char *argv[]) &newargv[2], &handle); free_argv(); + fflush(stdout); } if (tablename && (strcmp(tablename, curtable) != 0)) continue;