]> Pileus Git - ~andy/fetchmail/commitdiff
Better portability, I hope...
authorEric S. Raymond <esr@thyrsus.com>
Wed, 17 Sep 1997 21:08:57 +0000 (21:08 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 17 Sep 1997 21:08:57 +0000 (21:08 -0000)
svn path=/trunk/; revision=1361

daemon.c

index 7ca19ff8b114dfacdfab443525c378b3cfc31c02..f71d034338a1f9aa504a6e8fc2be351ee304f04c 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -54,28 +54,25 @@ RETSIGTYPE
 sigchld_handler (int sig)
 /* process SIGCHLD to obtain the exit code of the terminating process */
 {
-  pid_t pid;
+    pid_t pid;
 
+#if    defined(HAVE_WAITPID)                           /* the POSIX way */
+    int status;
+
+    while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
+       continue; /* swallow 'em up. */
+#elif  defined(HAVE_WAIT3)                             /* the BSD way */
 #if defined(HAVE_UNION_WAIT) && !defined(__FreeBSD__)
-  union wait status;
+    union wait status;
 #else
-  int status;
+    int status;
 #endif
 
-#if    defined(HAVE_WAIT3)
-#ifdef oldhpux /* HP-UX fixed this sometime between 9.01 and 10.20 */
-  while ((pid = wait3(&status, WNOHANG, (int *) 0)) > 0)
-#else
-  while ((pid = wait3(&status, WNOHANG, (struct rusage *) 0)) > 0)
-#endif
-    ; /* swallow 'em up. */
-#elif  defined(HAVE_WAITPID)
-  while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
-    ; /* swallow 'em up. */
+    while ((pid = wait3(&status, WNOHANG, 0)) > 0)
+       continue; /* swallow 'em up. */
 #else  /* Zooks! Nothing to do but wait(), and hope we don't block... */
-  wait(&status);
+    wait(&status);
 #endif
-
 }
 
 int