From 1eafb30a4485eab827e13954909ec89f54461936 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 1 Jun 2010 10:58:11 -0400 Subject: [PATCH] Fix a bug where we could treat EAGAIN as a permanent error. Also set cstat if perform_io() returns an error. --- src/exec.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/exec.c b/src/exec.c index ccea358fe..b234ef238 100644 --- a/src/exec.c +++ b/src/exec.c @@ -799,12 +799,11 @@ 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; } - break; } if (cstat->type == CMD_WSTATUS) { if (WIFSTOPPED(cstat->val)) { @@ -840,8 +839,11 @@ 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) { -- 2.50.0