Skip to content

Commit 73fa90b

Browse files
AZero13millert
authored andcommitted
We ought to be checking type, not val, for CMD_INVALID
1 parent 9c040c7 commit 73fa90b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/exec_monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ mon_errsock_cb(int fd, int what, void *v)
276276
nread = read(fd, &errval, sizeof(errval));
277277
if (nread < 0) {
278278
if (errno != EAGAIN && errno != EINTR) {
279-
if (mc->cstat->val == CMD_INVALID) {
279+
if (mc->cstat->type == CMD_INVALID) {
280280
/* XXX - need a way to distinguish non-exec error. */
281281
mc->cstat->type = CMD_ERRNO;
282282
mc->cstat->val = errno;

src/exec_nopty.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ errpipe_cb(int fd, int what, void *v)
8282
switch (nread) {
8383
case -1:
8484
if (errno != EAGAIN && errno != EINTR) {
85-
if (ec->cstat->val == CMD_INVALID) {
85+
if (ec->cstat->type == CMD_INVALID) {
8686
/* XXX - need a way to distinguish non-exec error. */
8787
ec->cstat->type = CMD_ERRNO;
8888
ec->cstat->val = errno;

src/exec_pty.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ backchannel_cb(int fd, int what, void *v)
678678
/* Nothing ready. */
679679
break;
680680
default:
681-
if (ec->cstat->val == CMD_INVALID) {
681+
if (ec->cstat->type == CMD_INVALID) {
682682
ec->cstat->type = CMD_ERRNO;
683683
ec->cstat->val = errno;
684684
sudo_debug_printf(SUDO_DEBUG_ERROR,
@@ -752,7 +752,7 @@ backchannel_cb(int fd, int what, void *v)
752752
break;
753753
default:
754754
/* Short read, should not happen. */
755-
if (ec->cstat->val == CMD_INVALID) {
755+
if (ec->cstat->type == CMD_INVALID) {
756756
ec->cstat->type = CMD_ERRNO;
757757
ec->cstat->val = EIO;
758758
sudo_debug_printf(SUDO_DEBUG_ERROR,
@@ -1443,7 +1443,7 @@ exec_pty(struct command_details *details,
14431443
/* error from callback */
14441444
sudo_debug_printf(SUDO_DEBUG_ERROR, "event loop exited prematurely");
14451445
/* XXX: no good way to know if we should terminate the command. */
1446-
if (cstat->val == CMD_INVALID && ec->cmnd_pid != -1) {
1446+
if (cstat->type == CMD_INVALID && ec->cmnd_pid != -1) {
14471447
/* no status message, kill command */
14481448
terminate_command(ec->cmnd_pid, true);
14491449
ec->cmnd_pid = -1;

0 commit comments

Comments
 (0)