summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorDamien Chaumette <dchaumette@mandriva.com>2002-08-19 17:46:59 +0000
committerDamien Chaumette <dchaumette@mandriva.com>2002-08-19 17:46:59 +0000
commit3837223751e5455a5e5a397cdfe51285a2bbc2d1 (patch)
treec9b99b04cf7a7868a57fd86a9408b70f5ff2b035 /perl-install
parent52457bbff77a86b2e1bc58bb906b7d7e3828aea2 (diff)
downloaddrakx-3837223751e5455a5e5a397cdfe51285a2bbc2d1.tar
drakx-3837223751e5455a5e5a397cdfe51285a2bbc2d1.tar.gz
drakx-3837223751e5455a5e5a397cdfe51285a2bbc2d1.tar.bz2
drakx-3837223751e5455a5e5a397cdfe51285a2bbc2d1.tar.xz
drakx-3837223751e5455a5e5a397cdfe51285a2bbc2d1.zip
o remove old /etc/hosts entries for the hostname before adding new one
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/network/network.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 0a336ba6d..5d1e1c784 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -147,7 +147,12 @@ sub add2hosts {
local *F;
if (-e $file) {
open F, $file or die "cannot open $file: $!";
- /\s*(\S+)(.*)/ and $l{$1} ||= $2 foreach <F>;
+ #/\s*(\S+)(.*)/ and $l{$1} ||= $2 foreach <F>;
+ foreach (<F>) {
+ m/\s*(\S+)(.*)/;
+ my ($ip, $host) = ($1, $2);
+ $l{$ip} ||= $host if $host !~ /^\s*$hostname\s*$/;
+ }
}
log::l("writing host information to $file");
open F, ">$file" or die "cannot write $file: $!";