summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2008-08-06 18:31:28 -0700
committerStig Thormodsrud <stig@vyatta.com>2008-08-06 18:31:28 -0700
commit177108f7c6de8af36164ea247267e91851432222 (patch)
tree875e0e5d9adbdcaae09623449db92f8c89fc17e2 /scripts
parentcf7ce7c5ba91398387ba2558d834181167185ff1 (diff)
downloadvyatta-nat-177108f7c6de8af36164ea247267e91851432222.tar.gz
vyatta-nat-177108f7c6de8af36164ea247267e91851432222.zip
Use unbuffered writes in pipe mode.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-nat-translations.pl9
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/vyatta-nat-translations.pl b/scripts/vyatta-nat-translations.pl
index 681845f..a272725 100755
--- a/scripts/vyatta-nat-translations.pl
+++ b/scripts/vyatta-nat-translations.pl
@@ -189,16 +189,15 @@ if (! -f $conntrack) {
my $xs = XML::Simple->new(ForceArray => 1, KeepRoot => 0);
my ($xml, $data);
+# flush stdout after every write for pipe mode
+$! = 1 if defined $pipe;
+
if (defined $verbose) {
printf($verbose_format, 'Pre-NAT src', 'Pre-NAT dst',
'Post-NAT src', 'Post-NAT dst');
} else {
printf($format, 'Pre-NAT', 'Post-NAT', 'Type', 'Prot', 'Timeout');
- if (defined $pipe) {
- # flush stdout after every write
- $| = 1;
- print " Type";
- }
+ print " Type" if defined $pipe;
print "\n";
}