summaryrefslogtreecommitdiffstats
path: root/urpm/cfg.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-30 12:49:50 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-30 12:49:50 +0000
commita1ead6655ba5d07c6adbbe1e82c8d76bb55987e5 (patch)
tree36a8bc3b3602efac5717747ac364096539bf328b /urpm/cfg.pm
parent5d9cfb92ead5d8c23a278de2546a7f9468897743 (diff)
downloadurpmi-a1ead6655ba5d07c6adbbe1e82c8d76bb55987e5.tar
urpmi-a1ead6655ba5d07c6adbbe1e82c8d76bb55987e5.tar.gz
urpmi-a1ead6655ba5d07c6adbbe1e82c8d76bb55987e5.tar.bz2
urpmi-a1ead6655ba5d07c6adbbe1e82c8d76bb55987e5.tar.xz
urpmi-a1ead6655ba5d07c6adbbe1e82c8d76bb55987e5.zip
Protection against the people who edit urpmi.cfg by hand and put the
same medium twice. And restore error messages.
Diffstat (limited to 'urpm/cfg.pm')
-rw-r--r--urpm/cfg.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/urpm/cfg.pm b/urpm/cfg.pm
index ec8f064a..191b2108 100644
--- a/urpm/cfg.pm
+++ b/urpm/cfg.pm
@@ -3,6 +3,7 @@ package urpm::cfg;
use strict;
use warnings;
use urpm::util;
+use urpm::msg 'N';
=head1 NAME
@@ -70,8 +71,14 @@ sub load_config ($) {
$medium = '';
next;
}
- if (/^(.*?[^\\])\s+(?:(.*?[^\\])\s+)?{$/) { #-} medium definition
- $config{ $medium = unquotespace $1 }{url} = unquotespace $2;
+ if (/^(.*?[^\\])\s+(?:(.*?[^\\])\s+)?{$/) { #- medium definition
+ $medium = unquotespace $1;
+ if ($config{$medium}) {
+ #- hmm, somebody fudged urpmi.cfg by hand.
+ $err = N("medium `%s' is defined twice, aborting", $medium);
+ return;
+ }
+ $config{$medium}{url} = unquotespace $2;
next;
}
#- config values