From 73eda008be1bf07a31379bd42fff9ee140d187bc Mon Sep 17 00:00:00 2001 From: damien Date: Wed, 10 Oct 2001 16:11:16 +0000 Subject: updated --- perl-install/network/tools.pm | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'perl-install/network') diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index f99ad48e7..a93dd2226 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -116,34 +116,32 @@ sub connected { gethostbyname("mandrakesoft.com") ? 1 : 0 } my $kid_pipe; sub connected_bg { + local $|=1; my ($ref) = @_; if (defined $kid_pipe) { local *F; *F = *$kid_pipe; - fcntl(F, F_SETFL, O_NONBLOCK) or die "can't fcntl F_SETFL: $!"; + fcntl(F, c::F_SETFL, c::O_NONBLOCK) or die "can't fcntl F_SETFL: $!"; my $a; if ($a = ) { - chomp $a; close($kid_pipe) || warn "kid exited $?"; undef $kid_pipe; $a eq '1' and $$ref = 1; $a eq '0' and $$ref = 0; } - } else { - $kid_pipe = connected2(); - } + } else { $kid_pipe = connected2() } 1; } sub connected2 { - my $pid = open(KID_TO_READ, "-|"); - if ($pid) { # parent - return \*KID_TO_READ; - } else { # child - ($EUID, $EGID) = ($UID, $GID); # suid only - my $a = gethostbyname("mandrakesoft.com") ? 1 : 0; - c::_exit(0); - } + my $pid = open(KID_TO_READ, "-|"); + if ($pid) { # parent + return \*KID_TO_READ; + } else { # child + my $a = gethostbyname("mandrakesoft.com") ? 1 : 0; + print "$a"; + c::_exit(0); + } } sub disconnected { } -- cgit v1.2.1