If not logging I/O we may get EOF when the command is executed and

the other end of the backchannel is closed.  Just remove the
backchannel event in this case or we will continue to receive
the event.  Bug #631
This commit is contained in:
Todd C. Miller
2014-01-14 10:54:56 -07:00
parent 6a76d1a1c2
commit d7277fc96e

View File

@@ -230,11 +230,14 @@ backchannel_cb(int fd, int what, void *v)
/* Short read or EOF. */ /* Short read or EOF. */
sudo_debug_printf(SUDO_DEBUG_ERROR, sudo_debug_printf(SUDO_DEBUG_ERROR,
"failed to read child status: %s", n ? "short read" : "EOF"); "failed to read child status: %s", n ? "short read" : "EOF");
if (!ec->log_io && n == 0) {
/* /*
* If not logging I/O we may get EOF when the command is * If not logging I/O we may get EOF when the command is
* executed and sv is closed. It is safe to ignore this. * executed and the other end of the backchannel is closed.
* Just remove the event in this case.
*/ */
if (ec->log_io || n != 0) { (void)sudo_ev_del(ec->evbase, backchannel_event);
} else {
/* XXX - need new CMD_ type for monitor errors. */ /* XXX - need new CMD_ type for monitor errors. */
errno = n ? EIO : ECONNRESET; errno = n ? EIO : ECONNRESET;
ec->cstat->type = CMD_ERRNO; ec->cstat->type = CMD_ERRNO;