diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-07-06 16:46:08 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-08-12 22:04:15 -0700 |
commit | 0b84adc1dbb527ea7ce39aaa5cd992f09056d07d (patch) | |
tree | 33687ec29f6dd5a5603ce9b454f4fa5f0c3b80c6 /scripts/vyatta-show-bonding.pl | |
parent | 093cfe75a832c333e83e08bbb37a082e811a9e44 (diff) | |
download | vyatta-op-0b84adc1dbb527ea7ce39aaa5cd992f09056d07d.tar.gz vyatta-op-0b84adc1dbb527ea7ce39aaa5cd992f09056d07d.zip |
Fix error message from show bonding
Bug 4628
If bond device has no slaves, then get_sysfs_value will return undefined,
instead of empty string.
Diffstat (limited to 'scripts/vyatta-show-bonding.pl')
-rwxr-xr-x | scripts/vyatta-show-bonding.pl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/vyatta-show-bonding.pl b/scripts/vyatta-show-bonding.pl index 902be4e..62d503e 100755 --- a/scripts/vyatta-show-bonding.pl +++ b/scripts/vyatta-show-bonding.pl @@ -104,13 +104,15 @@ sub show { die "Invalid bonding interface: $intf\n" unless (-d "/sys/class/net/$intf/bonding" ); - my @slaves = split( / /, get_sysfs_value( $intf, "bonding/slaves" ) ); + my $slaves = get_sysfs_value( $intf, "bonding/slaves" ); + next unless $slaves; + printf $format, $intf, get_sysfs_value( $intf, "statistics/rx_bytes" ), get_sysfs_value( $intf, "statistics/rx_packets" ), get_sysfs_value( $intf, "statistics/tx_bytes" ), get_sysfs_value( $intf, "statistics/tx_packets" ); - foreach my $slave (sort @slaves) { + foreach my $slave (sort split( / /, $slaves)) { printf $format, ' ' . $slave, get_sysfs_value( $slave, "statistics/rx_bytes" ), get_sysfs_value( $slave, "statistics/rx_packets" ), |