summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-26 16:04:03 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-26 16:04:03 -0800
commitdaceffa1505f7a74bd16b0a939d2c6dfd862a859 (patch)
tree9cbb11cd9d4d8436f9140abeadaaf81e058da7ec /lib
parent86bf383499d375f0b9a11384ee65ccb74fbb8595 (diff)
downloadvyatta-cfg-daceffa1505f7a74bd16b0a939d2c6dfd862a859.tar.gz
vyatta-cfg-daceffa1505f7a74bd16b0a939d2c6dfd862a859.zip
config load: avoid possible bug in getConfigDiff
The map function operates on an alias of the passed list, so any modification of the elements has bad side effects. Make an explicit copy instead: Original warning: Don't modify $_ in list functions at line 410, column 17. See page 114 of PBP. (Severity: 5)
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/ConfigLoad.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Vyatta/ConfigLoad.pm b/lib/Vyatta/ConfigLoad.pm
index 8376db4..54411ee 100755
--- a/lib/Vyatta/ConfigLoad.pm
+++ b/lib/Vyatta/ConfigLoad.pm
@@ -82,7 +82,7 @@ sub get_regex_rank {
return $regex_rank{$_};
}
}
- # returns undef if no match
+ return; # undef if no match
}
sub get_config_rank {
@@ -407,7 +407,12 @@ sub getConfigDiff {
# need to filter out deletions of nodes with default values
my @new_delete_list = ();
foreach my $del (@delete_list) {
- my @comps = map { s/^'(.*)'$/$1/; $_; } @{${$del}[0]};
+ my @comps = map {
+ my $file = $_;
+ $file =~ s/^'(.*)'$/$1/;
+ $file;
+ } @{${$del}[0]};
+
my ($is_multi, $is_text, $default) = $active_cfg->parseTmpl(\@comps);
if (!defined($default)) {
push @new_delete_list, $del;