Try this (against last night's cvs:)

--- utils.c.orig     Mon Jan  7 09:33:53 2002
+++ utils.c      Mon Jan  7 10:12:05 2002
@@ -887,8 +887,21 @@
 process_alive(pid)
  pid_t pid;
 {
-  while((waitpid(pid, NULL, WNOHANG) < 0) && errno == EINTR);
-       /* do nothing */
+ int ret;
+ int i;
+
+ /*
+  * Invalid argument
+  */
+ if(!pid)
+   return 0;
+
+  /*
+   * We attempt to use kill. But first, we
+   * wait() for the process, just in case it's a zombie.
+   */
+  for(i=0,ret=1;(i<100) && (ret > 0);i++)
+    ret = waitpid(pid, NULL, WNOHANG);

   return kill(pid, 0) == 0;
 }

Reply via email to