diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-04-20 21:08:07 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-04-20 21:08:07 -0700 |
commit | 6bca3f1426f611e4bf5ac439129498664f672eb1 (patch) | |
tree | 06f97331063032ccc4d17140323698ced4655439 /scripts | |
parent | 0115b0edf57af29f5c234031936c445c3bf5ac73 (diff) | |
download | vyatta-cfg-6bca3f1426f611e4bf5ac439129498664f672eb1.tar.gz vyatta-cfg-6bca3f1426f611e4bf5ac439129498664f672eb1.zip |
Use undef for false
Standard perl convention is undefined for false rather than 0.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 60e0c84..997230d 100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -86,7 +86,7 @@ exit 0; sub is_ip_configured { my ($intf, $ip) = @_; my @found = grep $ip, getIP($intf); - return $#found; + return ($#found > 0); } sub is_ip_duplicate { @@ -99,17 +99,12 @@ sub is_ip_duplicate { chomp @ipaddrs; my %ipaddrs_hash = map { $_ => 1 } @ipaddrs; - if (defined $ipaddrs_hash{$ip}) { - # - # allow dup if it's the same interface - # - if (is_ip_configured($intf, $ip)) { - return 0; - } - return 1; - } else { - return 0; - } + return unless($ipaddrs_hash{$ip}); + + # + # allow dup if it's the same interface + # + return is_ip_configured($intf, $ip); } sub touch { |