]> Pileus Git - ~andy/fetchmail/blobdiff - daemon.c
Add new gai.c debug source.
[~andy/fetchmail] / daemon.c
index feacfedc73282cd7c8104fa307f593ce10c6d383..5ae73ed69565c6bd0d299b85e503494d0d448100 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -57,13 +57,13 @@ static RETSIGTYPE
 sigchld_handler (int sig)
 /* process SIGCHLD to obtain the exit code of the terminating process */
 {
-    pid_t pid;
 #if    defined(HAVE_WAITPID)                           /* the POSIX way */
     int status;
 
-    while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
+    while (waitpid(-1, &status, WNOHANG) > 0)
        continue; /* swallow 'em up. */
 #elif  defined(HAVE_WAIT3)                             /* the BSD way */
+    pid_t pid;
 #if defined(HAVE_UNION_WAIT) && !defined(__FreeBSD__)
     union wait status;
 #else
@@ -208,7 +208,7 @@ nottyDetach:
   (void)close(0);
 
   /* Reopen stdin descriptor on /dev/null */
-  if ((fd = open("/dev/null", O_RDWR)) < 0) {   /* stdin */
+  if (open("/dev/null", O_RDWR) < 0) {   /* stdin */
     report(stderr, "cannot open /dev/null: %s\n", strerror(errno));
     return(PS_IOERR);
   }
@@ -218,10 +218,9 @@ nottyDetach:
       if ((logfd = open(logfile, O_CREAT|O_WRONLY|O_APPEND, 0666)) < 0) {      /* stdout */
          report(stderr, "cannot open %s: %s\n", logfile, strerror(errno));
          return PS_IOERR;
-      } else
-         logfd = 0;    /* use /dev/null */
+      }
   } else
-      logfd = 0;    /* this is /dev/null */
+      logfd = 0;    /* else use /dev/null */
 
   /* Close any/all open file descriptors */
 #if    defined(HAVE_GETDTABLESIZE)