From a1ead6655ba5d07c6adbbe1e82c8d76bb55987e5 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Wed, 30 Jun 2004 12:49:50 +0000 Subject: Protection against the people who edit urpmi.cfg by hand and put the same medium twice. And restore error messages. --- urpm/cfg.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'urpm/cfg.pm') 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 -- cgit v1.2.1