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 (n == -1) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
if (log_io && errno != EAGAIN) {
|
if (errno != EAGAIN) {
|
||||||
/* Did the other end of the pipe go away? */
|
|
||||||
cstat->type = CMD_ERRNO;
|
cstat->type = CMD_ERRNO;
|
||||||
cstat->val = errno;
|
cstat->val = errno;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (cstat->type == CMD_WSTATUS) {
|
if (cstat->type == CMD_WSTATUS) {
|
||||||
if (WIFSTOPPED(cstat->val)) {
|
if (WIFSTOPPED(cstat->val)) {
|
||||||
/* Suspend parent and tell child how to resume on return. */
|
/* 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;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (log_io) {
|
if (log_io) {
|
||||||
/* Flush any remaining output (the plugin already got it) */
|
/* Flush any remaining output (the plugin already got it) */
|
||||||
|
Reference in New Issue
Block a user