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
(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);
}
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)