From: Todd C. Miller Date: Wed, 26 May 2010 15:19:17 +0000 (-0400) Subject: Now that we defer sending cstat until the end of script_child() X-Git-Tag: SUDO_1_8_0~585 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=efa908448d6cd1e0af0bf2f6fa4568215ac870a6;p=sudo Now that we defer sending cstat until the end of script_child() we cannot reuse cstat when reading command status from parent. --- diff --git a/src/script.c b/src/script.c index 67edf0650..4a0e351e0 100644 --- a/src/script.c +++ b/src/script.c @@ -791,6 +791,7 @@ script_execve(struct command_details *details, char *argv[], char *envp[], cstat->type = CMD_ERRNO; cstat->val = errno; } + break; } if (cstat->type == CMD_WSTATUS) { if (WIFSTOPPED(cstat->val)) { @@ -1171,19 +1172,21 @@ script_child(struct command_details *details, char *argv[], char *envp[], errpipe[0] = -1; } if (FD_ISSET(backchannel, fdsr)) { + struct command_status cstmp; + /* read command from backchannel, should be a signal */ - n = recv(backchannel, &cstat, sizeof(cstat), 0); + n = recv(backchannel, &cstmp, sizeof(cstmp), 0); if (n == -1) { if (errno == EINTR) continue; warning("error reading from socketpair"); goto done; } - if (cstat.type != CMD_SIGNO) { - warningx("unexpected reply type on backchannel: %d", cstat.type); + if (cstmp.type != CMD_SIGNO) { + warningx("unexpected reply type on backchannel: %d", cstmp.type); continue; } - deliver_signal(child, cstat.val); + deliver_signal(child, cstmp.val); } }