diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-07-06 16:46:08 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-07-06 17:10:57 -0700 |
commit | c5c6a358db1d88d7064f01ab0813e6d1799a300f (patch) | |
tree | 038f7b58278621d98f3481c53aefe4e5da3bff5e | |
parent | aa24d009349b76211ba8e07b55d1763aa4dcc19b (diff) | |
download | vyatta-op-c5c6a358db1d88d7064f01ab0813e6d1799a300f.tar.gz vyatta-op-c5c6a358db1d88d7064f01ab0813e6d1799a300f.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.
-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" ), |