goto done;
}
if (n == -1) {
- if (errno == EAGAIN || errno == EINTR)
- continue;
/* Error reading signal_pipe[0], should not happen. */
break;
}
/*
* Read signals on fd written to by handler().
- * Returns -1 on error (possibly non-fatal), 0 on child exit, else 1.
+ * Returns -1 on error, 0 on child exit, else 1.
*/
static int
handle_signals(fd, child, cstat)
/* It should not be possible to get EOF but just in case. */
if (nread == 0)
errno = ECONNRESET;
- if (errno != EINTR && errno != EAGAIN) {
- cstat->type = CMD_ERRNO;
- cstat->val = errno;
- }
+ /* Restart if interrupted by signal so the pipe doesn't fill. */
+ if (errno == EINTR)
+ continue;
+ /* If pipe is empty, we are done. */
+ if (errno == EAGAIN)
+ break;
+ cstat->type = CMD_ERRNO;
+ cstat->val = errno;
return -1;
}
if (signo == SIGCHLD) {