iptables: flush stdout after every verbose log.
Ensures that each logged line is flushed to stdout after it's
written, and not held in any buffer.
Test: manual
Bug: 32323979
Change-Id: Iffe2bdc72582eef54843da41c65289faeeb4fe51
diff --git a/iptables/ip6tables-restore.c b/iptables/ip6tables-restore.c
index 31bc502..e17ad9d 100644
--- a/iptables/ip6tables-restore.c
+++ b/iptables/ip6tables-restore.c
@@ -268,8 +268,10 @@
if (buffer[0] == '\n')
continue;
else if (buffer[0] == '#') {
- if (verbose)
+ if (verbose) {
fputs(buffer, stdout);
+ fflush(stdout);
+ }
continue;
} else if ((strcmp(buffer, "COMMIT\n") == 0) && (in_table)) {
if (!testing) {
diff --git a/iptables/iptables-restore.c b/iptables/iptables-restore.c
index 2009f73..4d49b3c 100644
--- a/iptables/iptables-restore.c
+++ b/iptables/iptables-restore.c
@@ -268,8 +268,10 @@
if (buffer[0] == '\n')
continue;
else if (buffer[0] == '#') {
- if (verbose)
+ if (verbose) {
fputs(buffer, stdout);
+ fflush(stdout);
+ }
continue;
} else if ((strcmp(buffer, "COMMIT\n") == 0) && (in_table)) {
if (!testing) {