Fix a bug where we could treat EAGAIN as a permanent error.

Also set cstat if perform_io() returns an error.
This commit is contained in:
Todd C. Miller
2010-06-01 10:58:11 -04:00
parent 2ee7524101
commit 1eafb30a44

View File

@@ -799,13 +799,12 @@ sudo_execve(struct command_details *details, char *argv[], char *envp[],
if (n == -1) {
if (errno == EINTR)
continue;
if (log_io && errno != EAGAIN) {
/* Did the other end of the pipe go away? */
if (errno != EAGAIN) {
cstat->type = CMD_ERRNO;
cstat->val = errno;
}
break;
}
}
if (cstat->type == CMD_WSTATUS) {
if (WIFSTOPPED(cstat->val)) {
/* Suspend parent and tell child how to resume on return. */
@@ -840,9 +839,12 @@ sudo_execve(struct command_details *details, char *argv[], char *envp[],
}
}
}
if (perform_io(iobufs, fdsr, fdsw) != 0)
if (perform_io(iobufs, fdsr, fdsw) != 0) {
cstat->type = CMD_ERRNO;
cstat->val = errno;
break;
}
}
if (log_io) {
/* Flush any remaining output (the plugin already got it) */