]> granicus.if.org Git - transmission/commitdiff
(trunk, libT) #5452 'preventing zombies from child scripts' -- fixed.
authorJordan Lee <jordan@transmissionbt.com>
Mon, 5 Aug 2013 13:07:23 +0000 (13:07 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Mon, 5 Aug 2013 13:07:23 +0000 (13:07 +0000)
libtransmission/torrent.c

index f24433140992c1fe495db8f73a201ae58b16b3f2..896c41e85007ede3353bdc00d6c3bf420e45fe87 100644 (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