X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=daemon.c;h=5ae73ed69565c6bd0d299b85e503494d0d448100;hb=e75c62b234a699557c023970466a8accd0b5a7b2;hp=feacfedc73282cd7c8104fa307f593ce10c6d383;hpb=d0da38ee3f178d260ccb80875d5d5fd7e9b3fd98;p=~andy%2Ffetchmail diff --git a/daemon.c b/daemon.c index feacfedc..5ae73ed6 100644 --- 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)