Remove redhat bug whereby while(read(,my ,1)) {..} stuck in a loop

This commit is contained in:
duncan_ferguson 2004-04-29 14:59:05 +00:00
parent 0ef5aa0ff2
commit d936baebb8

View file

@ -103,6 +103,7 @@ if($options{x})
# this is the child # this is the child
exec(@ARGV) || die("Could not exec within x: $!"); exec(@ARGV) || die("Could not exec within x: $!");
} else { } else {
print "Forked to:$pid from $$" if($options{d});
# this is the parent # this is the parent
use IO::Select; use IO::Select;
@ -134,19 +135,17 @@ if($options{x})
{ {
if($fh == $READER) if($fh == $READER)
{ {
while(read($READER,my $char,1)) read($READER,my $char,1);
print "Received:$char:\n" if ($options{d});
last OUTTER if(ord($char) == $KILLOFF);
print "Pipe removed\n" if ($options{d} && ! -p $options{x});
last if(! -p $options{x});
unless(ioctl(STDIN,$TIOCSTI,$char))
{ {
print "Received:$char:\n" if ($options{d}); print "failed to write to client\n";
last OUTTER if(ord($char) == $KILLOFF); last OUTTER;
print "Pipe removed\n" if ($options{d} && ! -p $options{x});
last if(! -p $options{x});
unless(ioctl(STDIN,$TIOCSTI,$char))
{
print "failed to write to client\n";
last OUTTER;
}
} }
} }
} }
@ -169,6 +168,9 @@ if($options{x})
############################################################################ ############################################################################
# $Log$ # $Log$
# Revision 1.3 2004/04/29 14:59:05 duncan_ferguson
# Remove redhat bug whereby while(read(,my ,1)) {..} stuck in a loop
#
# Revision 1.2 2004/04/28 08:28:14 duncan_ferguson # Revision 1.2 2004/04/28 08:28:14 duncan_ferguson
# added -d debug option for some small debug output # added -d debug option for some small debug output
# #