1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

dead_child_handler also takes care of reaping pingpong server dead child processes

This commit is contained in:
Yang Tse 2009-12-21 14:43:29 +00:00
parent bdd3763980
commit fa188eec7b

View File

@ -110,6 +110,19 @@ sub exit_signal_handler {
exit;
}
#**********************************************************************
# dead_child_handler takes care of reaping dead child processes.
#
sub dead_child_handler {
use POSIX ":sys_wait_h";
local $!; # preserve errno
local $?; # preserve exit status
while (waitpid(-1, &WNOHANG) > 0) {
select(undef, undef, undef, 0.05);
}
$SIG{CHLD} = \&dead_child_handler;
}
#**********************************************************************
# getlogfilename returns a log file name depending on given arguments.
#
@ -204,6 +217,7 @@ if($proto !~ /^(ftp|imap|pop3|smtp)\z/) {
$SIG{INT} = \&exit_signal_handler;
$SIG{TERM} = \&exit_signal_handler;
$SIG{CHLD} = \&dead_child_handler;
sub sysread_or_die {
my $FH = shift;