]> granicus.if.org Git - sudo/commitdiff
If the event loop exits due to an error and we are not logging I/O,
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 15 Jan 2014 03:34:20 +0000 (20:34 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 15 Jan 2014 03:34:20 +0000 (20:34 -0700)
kill the command if still running.  Fixes a bug where sudo could
exit while the command was still running.

src/exec.c

index 744ee615b2370e6c191905c76a4ee4d0facf19ce..13476d38457dad87c476006bcd248770bfc85d43 100644 (file)
@@ -483,6 +483,9 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
     if (sudo_ev_got_break(evbase)) {
        /* error from callback */
        sudo_debug_printf(SUDO_DEBUG_ERROR, "event loop exited prematurely");
+       /* kill command if still running and not I/O logging */
+       if (!log_io && kill(child, 0) == 0)
+           terminate_command(child, true);
     }
 
     if (log_io) {