catch wierd waitpid infinite loop
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 29 May 1993 05:43:46 +0000 (21:43 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 29 May 1993 05:43:46 +0000 (21:43 -0800)
SCCS-vsn: usr.sbin/sendmail/src/conf.c 6.61

usr/src/usr.sbin/sendmail/src/conf.c

index 4bf5e5b..909abbb 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     6.60 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     6.61 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/ioctl.h>
 #endif /* not lint */
 
 # include <sys/ioctl.h>
@@ -901,9 +901,19 @@ reapchild()
 {
 # ifdef WIFEXITED
        auto int status;
 {
 # ifdef WIFEXITED
        auto int status;
+       int count;
+       int pid;
 
 
-       while (waitpid(-1, &status, WNOHANG) > 0)
-               continue;
+       count = 0;
+       while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
+       {
+               if (count++ > 1000)
+               {
+                       syslog(LOG_ALERT, "reapchild: waitpid loop: pid=%d, status=%x",
+                               pid, status);
+                       break;
+               }
+       }
 # else
 # ifdef WNOHANG
        union wait status;
 # else
 # ifdef WNOHANG
        union wait status;