diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-20 14:50:43 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-20 15:03:06 -0700 |
commit | 71b9bb01926ee220b73fb3135c5e7f5de9c80023 (patch) | |
tree | bf70a8b79cd44b6b7bfe93ff7d0ac338c1f5ed74 /lib/Vyatta/Qos/Util.pm | |
parent | ba5cad5145b11345fb195b79c806a02d9545bf0b (diff) | |
download | vyatta-cfg-qos-71b9bb01926ee220b73fb3135c5e7f5de9c80023.tar.gz vyatta-cfg-qos-71b9bb01926ee220b73fb3135c5e7f5de9c80023.zip |
Validate shaper class ceiling
Bug 5879
Diffstat (limited to 'lib/Vyatta/Qos/Util.pm')
-rw-r--r-- | lib/Vyatta/Qos/Util.pm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm index 7c7758d..afd6aaf 100644 --- a/lib/Vyatta/Qos/Util.pm +++ b/lib/Vyatta/Qos/Util.pm @@ -14,7 +14,6 @@ # Portions created by Vyatta are Copyright (C) 2008 Vyatta, Inc. # All Rights Reserved. # **** End License **** - package Vyatta::Qos::Util; use strict; use warnings; @@ -27,7 +26,7 @@ use base qw(Exporter); sub get_num { use POSIX qw(strtod); my ($str) = @_; - return unless $str; + return unless defined($str); # remove leading/trailing spaces $str =~ s/^\s+//; @@ -88,10 +87,10 @@ sub getAutoRate { sub getRate { my $rate = shift; - $rate or die "Rate not defined"; + defined $rate + or die "Rate not defined"; my ( $num, $suffix ) = get_num($rate); - defined $num or die "$rate is not a valid bandwidth (not a number)\n"; ( $num >= 0 ) |