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:
10
src/exec.c
10
src/exec.c
@@ -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) */
|
||||
|
Reference in New Issue
Block a user