From 6fc8481524aaeed31f3c8f4de443c8381518ea9a Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Mon, 5 Aug 2013 13:07:23 +0000 Subject: [PATCH] (trunk, libT) #5452 'preventing zombies from child scripts' -- fixed. --- libtransmission/torrent.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index f24433140..896c41e85 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -17,7 +17,6 @@ #include /* wait () */ #else #include - #define waitpid(pid, status, options) _cwait (status, pid, WAIT_CHILD) #endif #include /* stat */ #include @@ -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 -- 2.40.0