]> granicus.if.org Git - sudo/commitdiff
If not logging I/O we may get EOF when the command is executed and
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 14 Jan 2014 17:54:56 +0000 (10:54 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 14 Jan 2014 17:54:56 +0000 (10:54 -0700)
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

--HG--
branch : 1.8

src/exec.c

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