(trunk, libT) #5452 'preventing zombies from child scripts' -- fixed.

This commit is contained in:
Jordan Lee 2013-08-05 13:07:23 +00:00
parent 76528d8e14
commit 6fc8481524
1 changed files with 12 additions and 2 deletions

View File

@ -17,7 +17,6 @@
#include <sys/wait.h> /* wait () */
#else
#include <process.h>
#define waitpid(pid, status, options) _cwait (status, pid, WAIT_CHILD)
#endif
#include <unistd.h> /* stat */
#include <dirent.h>
@ -2073,7 +2072,18 @@ tr_torrentClearIdleLimitHitCallback (tr_torrent * torrent)
static void
onSigCHLD (int i UNUSED)
{
waitpid (-1, NULL, WNOHANG);
#ifdef WIN32
_cwait (NULL, -1, WAIT_CHILD);
#else
int rc;
do
rc = waitpid (-1, NULL, WNOHANG);
while (rc>0 || (rc==-1 && errno==EINTR));
#endif
}
static void