summaryrefslogtreecommitdiff
path: root/scripts/vyatta-qos.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vyatta-qos.pl')
-rwxr-xr-xscripts/vyatta-qos.pl18
1 files changed, 8 insertions, 10 deletions
diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl
index 8b8b978..328e8d7 100755
--- a/scripts/vyatta-qos.pl
+++ b/scripts/vyatta-qos.pl
@@ -157,26 +157,24 @@ sub update_interface {
# When doing debugging just echo the commands
my $out;
- if ( defined $debug ) {
- open $out, '>-'
- or die "can't open stdout: $!";
- }
- else {
+ unless ($debug) {
open $out, "|-"
or exec qw:sudo /sbin/tc -batch -:
or die "Tc setup failed: $!\n";
+
+ select $out;
}
- $shaper->commands( $out, $device, $direction );
- if ( !close $out && !defined $debug ) {
+ $shaper->commands( $device, $direction );
+ return if ($debug);
+ select STDOUT;
+ unless (close $out) {
# cleanup any partial commands
delete_interface( $device, $direction );
# replay commands to stdout
- open $out, '>-';
- $shaper->commands( $out, $device, $direction );
- close $out;
+ $shaper->commands($device, $direction );
die "TC command failed.";
}
}