diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-06-10 14:53:41 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-06-10 14:53:41 -0700 |
commit | 933516d19db0039c30ecf0609f963c68f8fc952c (patch) | |
tree | 31048d9793e4315e5f006bd92550a9fe77c9f14b /scripts/vyatta-show-interfaces.pl | |
parent | 116addafe3a9f44e457dcdfd957ffcb2b0c3e6b1 (diff) | |
download | vyatta-op-933516d19db0039c30ecf0609f963c68f8fc952c.tar.gz vyatta-op-933516d19db0039c30ecf0609f963c68f8fc952c.zip |
Do chomp in accessor routine for sysfs
Code is cleaner if the newline and cruft are stripped by get_sysfs_value.
Diffstat (limited to 'scripts/vyatta-show-interfaces.pl')
-rwxr-xr-x[-rw-r--r--] | scripts/vyatta-show-interfaces.pl | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl index e50c097..d9e74b2 100644..100755 --- a/scripts/vyatta-show-interfaces.pl +++ b/scripts/vyatta-show-interfaces.pl @@ -114,6 +114,7 @@ sub get_sysfs_value { or die "Can't open statistics file /sys/class/net/$intf/$name"; my $value = <$statf>; + chomp $value if defined $value; close $statf; return $value; } @@ -187,13 +188,11 @@ sub get_state_link { my $state; my $link = 'down'; my $flags = get_sysfs_value($intf, 'flags'); - chomp $flags; my $hex_flags = hex($flags); if ($hex_flags & 0x1) { # IFF_UP $state = 'up'; my $carrier = get_sysfs_value($intf, 'carrier'); - chomp $carrier; if ($carrier eq '1') { $link = "up"; } |