aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-03-31 13:30:24 +0000
committerThierry Vignaud <tv@mandriva.org>2008-03-31 13:30:24 +0000
commita18dcc6a1374f46fbb621683daa3956572bcc1aa (patch)
tree1aab12c13b51067748ee7fc06a87f137bebc8ee6
parent08799daa089f24812a4aaaa9208fca8abe823f3a (diff)
downloadrpmdrake-a18dcc6a1374f46fbb621683daa3956572bcc1aa.tar
rpmdrake-a18dcc6a1374f46fbb621683daa3956572bcc1aa.tar.gz
rpmdrake-a18dcc6a1374f46fbb621683daa3956572bcc1aa.tar.bz2
rpmdrake-a18dcc6a1374f46fbb621683daa3956572bcc1aa.tar.xz
rpmdrake-a18dcc6a1374f46fbb621683daa3956572bcc1aa.zip
(readconf) prevent crash by ignoring undefined values (crash hapenned
if config file set empty values for some variables (eg: after old gurpmi.addmedia garbaged it)) (#39511)
-rw-r--r--NEWS2
-rw-r--r--rpmdrake.pm3
2 files changed, 5 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 60bfd2e6..0a8a3ccd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
- rpmdrake:
o do not crash if package is unknow (#39608)
+ o do not crash if config file set empty values for some variables
+ (eg: after old buggy gurpmi.addmedia garbaged it) (#39511)
- gurpmi.addmedia:
o handle --mirrorlist (Anssi)
diff --git a/rpmdrake.pm b/rpmdrake.pm
index 4e2a3482..da4a8570 100644
--- a/rpmdrake.pm
+++ b/rpmdrake.pm
@@ -169,6 +169,9 @@ sub readconf() {
${$config{$_}{var}} = $config{$_}{default} foreach keys %config;
foreach my $l (cat_($configfile)) {
$l =~ /^\Q$_\E (.*)/ and ${$config{$_}{var}} = [ split ' ', $1 ] foreach keys %config;
+ foreach (keys %config) {
+ $l =~ /^\Q$_\E (.*)/ and $1 and ${$config{$_}{var}} = [ split ' ', $1 ];
+ }
}
# special cases:
$::rpmdrake_options{'no-confirmation'} = $no_confirmation->[0] if !defined $::rpmdrake_options{'no-confirmation'};