From: Todd C. Miller Date: Fri, 28 Apr 2017 16:32:15 +0000 (-0600) Subject: We no longer need to write to the tty if the command was killed by X-Git-Tag: SUDO_1_8_20^2~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dab8651ed21b3047d43beb597bf5bb9c0b699486;p=sudo We no longer need to write to the tty if the command was killed by a signal. Sudo will terminate itself with the same signal the command died from. Unfortunately, we lose the "core dumped" bit since sudo itself will not dump core, but there doesn't appear to be a way around that. --- diff --git a/src/exec_pty.c b/src/exec_pty.c index 7e12acbbf..4a05ee012 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -826,20 +826,7 @@ pty_close(struct command_status *cstat) if (io_fds[SFD_USERTTY] != -1) sudo_term_restore(io_fds[SFD_USERTTY], false); - /* If child was signalled, write the reason to stdout like the shell. */ - if (cstat->type == CMD_WSTATUS && WIFSIGNALED(cstat->val)) { - int signo = WTERMSIG(cstat->val); - if (signo && signo != SIGINT && signo != SIGPIPE) { - const char *reason = strsignal(signo); - n = io_fds[SFD_USERTTY] != -1 ? - io_fds[SFD_USERTTY] : STDOUT_FILENO; - if (write(n, reason, strlen(reason)) != -1) { - if (WCOREDUMP(cstat->val)) - ignore_result(write(n, " (core dumped)", 14)); - ignore_result(write(n, "\n", 1)); - } - } - } + /* Update utmp */ if (utmp_user != NULL) utmp_logout(slavename, cstat->type == CMD_WSTATUS ? cstat->val : 0); debug_return;