diff options
author | damien <damien@mandriva.com> | 2001-10-10 16:11:16 +0000 |
---|---|---|
committer | damien <damien@mandriva.com> | 2001-10-10 16:11:16 +0000 |
commit | 73eda008be1bf07a31379bd42fff9ee140d187bc (patch) | |
tree | 0e5045ea6dd9cad527a5e118038b7d14c32b5339 /perl-install/network | |
parent | a917592a709da212052ece005499d8d34de549f9 (diff) | |
download | drakx-73eda008be1bf07a31379bd42fff9ee140d187bc.tar drakx-73eda008be1bf07a31379bd42fff9ee140d187bc.tar.gz drakx-73eda008be1bf07a31379bd42fff9ee140d187bc.tar.bz2 drakx-73eda008be1bf07a31379bd42fff9ee140d187bc.tar.xz drakx-73eda008be1bf07a31379bd42fff9ee140d187bc.zip |
updated
Diffstat (limited to 'perl-install/network')
-rw-r--r-- | perl-install/network/tools.pm | 24 |
1 files changed, 11 insertions, 13 deletions
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 = <F> ) { - 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 { } |