From 85296d793a2320485fb075ae9ee09b62c72f8e96 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 13 Feb 2008 15:11:34 -0800 Subject: catch errors where dscp name is not defined This enforces syntax checks on dscp values. --- scripts/VyattaQosUtil.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/VyattaQosUtil.pm b/scripts/VyattaQosUtil.pm index 1d4a5e2..86b091a 100644 --- a/scripts/VyattaQosUtil.pm +++ b/scripts/VyattaQosUtil.pm @@ -129,7 +129,8 @@ sub getDsfield { } } close($ds) or die "read $dsFileName error\n"; - + + (defined $match) or die "\"$str\" unknown dsfield value\n"; return $match; } @@ -140,6 +141,7 @@ sub getIfIndex { open my $sysfs, "<", "/sys/class/net/$str/ifindex" || die "Unknown interface $str\n"; my $ifindex = <$sysfs>; close($sysfs) or die "read sysfs error\n"; + chomp $ifindex; return $ifindex; } -- cgit v1.2.3