summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/network.pm14
-rw-r--r--perl-install/network/tools.pm1
2 files changed, 6 insertions, 9 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index ceb9f4314..8b7fb7ce0 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -146,17 +146,13 @@ sub add2hosts {
my %l;
$l{$_} = $hostname foreach @ips;
- local *F;
- if (-e $file) {
- open F, $file or die "cannot open $file: $!";
- #/\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*$/;
- }
+ foreach (cat_($file)) {
+ m/\s*(\S+)(.*)/;
+ my ($ip, $host) = ($1, $2);
+ $l{$ip} ||= $host if $host !~ /^\s*$hostname\s*$/;
}
log::l("writing host information to $file");
+ local *F;
open F, ">$file" or die "cannot write $file: $!";
while (my ($ip, $v) = each %l) {
$ip or next;
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index dba446beb..2b9a4448f 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -207,6 +207,7 @@ sub test_connected {
}
sub connected2 {
+ local *KID_TO_READ;
my $pid = open(KID_TO_READ, "-|");
if ($pid) { # parent
$kid_pid = $pid;