diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-10-06 12:08:28 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-10-06 12:08:28 +0000 |
commit | 3fef4cbe0a0ffc1b125f35e40040b497325f6e4a (patch) | |
tree | 52fe619c67220d50119da9f6fedfb143a4549fb5 /perl-install/network | |
parent | 4c39b3418192570e70c5da673eb7f42b6ea5fdc7 (diff) | |
download | drakx-backup-do-not-use-3fef4cbe0a0ffc1b125f35e40040b497325f6e4a.tar drakx-backup-do-not-use-3fef4cbe0a0ffc1b125f35e40040b497325f6e4a.tar.gz drakx-backup-do-not-use-3fef4cbe0a0ffc1b125f35e40040b497325f6e4a.tar.bz2 drakx-backup-do-not-use-3fef4cbe0a0ffc1b125f35e40040b497325f6e4a.tar.xz drakx-backup-do-not-use-3fef4cbe0a0ffc1b125f35e40040b497325f6e4a.zip |
check both nfs servers version 2 and version 3, and remove duplicates (bug #6055)
Diffstat (limited to 'perl-install/network')
-rw-r--r-- | perl-install/network/nfs.pm | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/perl-install/network/nfs.pm b/perl-install/network/nfs.pm index e564d6fc7..dae09af1b 100644 --- a/perl-install/network/nfs.pm +++ b/perl-install/network/nfs.pm @@ -35,20 +35,26 @@ sub check { } sub find_servers { - my $pid = open(my $F, "rpcinfo-flushed -b mountd 2 |"); - $SIG{ALRM} = sub { kill(15, $pid) }; - alarm 1; + my $pid2 = open(my $F2, "rpcinfo-flushed -b mountd 2 |"); + my $pid3 = open(my $F3, "rpcinfo-flushed -b mountd 3 |"); + common::nonblock($F2); + common::nonblock($F3); my $domain = chomp_(`domainname`); - my @servers; - local $_; - while (<$F>) { - my ($ip, $name) = /(\S+)\s+(\S+)/ or log::explanations("bad line in rpcinfo output"), next; - $name =~ s/\Q.$domain//; - $name =~ s/\.$//; - push @servers, { ip => $ip, if_($name ne '(unknown)', name => $name) }; + my ($s, %servers); + my $quit; + while (!$quit) { + $quit = 1; + sleep 1; + while ($s = <$F2> || <$F3>) { + $quit = 0; + my ($ip, $name) = $s =~ /(\S+)\s+(\S+)/ or log::explanations("bad line in rpcinfo output"), next; + $name =~ s/\Q.$domain//; + $name =~ s/\.$//; + $servers{$ip} ||= { ip => $ip, if_($name ne '(unknown)', name => $name) }; + } } - @servers; + values %servers; } sub find_exports { |