Ken Thomases : libwine: 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: abe6a13ff1295a8d9290ed2141dd161b5b9b30d3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=abe6a13ff1295a8d9290ed2141dd161b5b9b30d3

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

libwine: Reap child process to avoid leaving a zombie.

---

 libs/wine/mmap.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c
index 63a597d..1529a85 100644
--- a/libs/wine/mmap.c
+++ b/libs/wine/mmap.c
@@ -101,7 +101,7 @@ static int try_mmap_fixed (void *addr, size_t len, int prot, int flags,
 {
     char * volatile result = NULL;
     int pagesize = getpagesize();
-    pid_t pid;
+    pid_t pid, wret;
 
     /* We only try to map to a fixed address if
        addr is non-NULL and properly aligned,
@@ -150,9 +150,10 @@ static int try_mmap_fixed (void *addr, size_t len, int prot, int flags,
        _exit(1);
     }
 
-    /* vfork() lets the parent continue only after the child
-       has exited.  Furthermore, Wine sets SIGCHLD to SIG_IGN,
-       so we don't need to wait for the child. */
+    /* reap child */
+    do {
+        wret = waitpid(pid, NULL, 0);
+    } while (wret < 0 && errno == EINTR);
 
     return result == addr;
 }




More information about the wine-cvs mailing list