Ken Thomases : secur32: Reap child process to avoid leaving a zombie.

Alexandre Julliard julliard at winehq.org
Thu Dec 1 14:05:32 CST 2011


Module: wine
Branch: master
Commit: 3de1c713647ced81675e4041beb9b254db45585e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3de1c713647ced81675e4041beb9b254db45585e

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Nov 30 16:49:27 2011 -0600

secur32: Reap child process to avoid leaving a zombie.

---

 dlls/secur32/dispatcher.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/secur32/dispatcher.c b/dlls/secur32/dispatcher.c
index ba59231..88e81ba 100644
--- a/dlls/secur32/dispatcher.c
+++ b/dlls/secur32/dispatcher.c
@@ -28,7 +28,10 @@
 #include <sys/types.h>
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
-#endif 
+#endif
+#ifdef HAVE_SYS_ERRNO_H
+#include <sys/errno.h>
+#endif
 #include <stdlib.h>
 #include <fcntl.h>
 #include "windef.h"
@@ -276,7 +279,7 @@ void cleanup_helper(PNegoHelper helper)
 {
 
     TRACE("Killing helper %p\n", helper);
-    if( (helper == NULL) || (helper->helper_pid == 0))
+    if(helper == NULL)
         return;
 
     HeapFree(GetProcessHeap(), 0, helper->com_buf);
@@ -285,6 +288,16 @@ void cleanup_helper(PNegoHelper helper)
     close(helper->pipe_out);
     close(helper->pipe_in);
 
+#ifdef HAVE_FORK
+    if (helper->helper_pid > 0) /* reap child */
+    {
+        pid_t wret;
+        do {
+            wret = waitpid(helper->helper_pid, NULL, 0);
+        } while (wret < 0 && errno == EINTR);
+    }
+#endif
+
     HeapFree(GetProcessHeap(), 0, helper);
 }
 




More information about the wine-cvs mailing list