From 52af890eda427954ed722e5ee14ee454efab6dfe Mon Sep 17 00:00:00 2001
From: garland <garland>
Date: Mon, 16 Aug 1993 12:26:42 +0000
Subject: [PATCH] The server process will now call wait to clean up zombie
 children when running under Mach.  There will be at most one <defunct>
 process at any given time.

---
 motif/server/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/motif/server/main.c b/motif/server/main.c
index 1ac54a10a..c6bdb9ee1 100644
--- a/motif/server/main.c
+++ b/motif/server/main.c
@@ -9,6 +9,8 @@
 #include <errno.h>
 #include <signal.h>
 
+#include <sys/wait.h>
+
 #define PORT 8000
 
 #define MAX(x,y) ((x<y)?y:x)
@@ -142,6 +144,7 @@ main(int argc, char **argv)
   fd_set rfds;
   int nfound,nfds,i;
   int port = PORT;
+  union wait status;
 
   /* This is so resources can be passed to the servers on the command line */
   global_argc = argc;
@@ -220,5 +223,7 @@ main(int argc, char **argv)
       printf("Accepting client on Inet socket.\n");
       establish_client(inet_socket);
     }
+    /* Prevent zombie children under Mach */
+    wait3(&status,WNOHANG,NULL);
   }
 }
-- 
GitLab