diff options
-rw-r--r-- | perl-install/network/network.pm | 7 |
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: $!"; |