From: Todd C. Miller Date: Thu, 29 Apr 2010 20:52:50 +0000 (-0400) Subject: Print signal info after restoring the tty mode, not before. X-Git-Tag: SUDO_1_8_0~685 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fc1ebd4f42aa3aeafaa8561593eb79920fbc0fe;p=sudo Print signal info after restoring the tty mode, not before. --- diff --git a/src/script.c b/src/script.c index 0e3dec175..5ce0b4236 100644 --- a/src/script.c +++ b/src/script.c @@ -686,6 +686,10 @@ script_execve(struct command_details *details, char *argv[], char *envp[], } flush_output(&output); + do { + n = term_restore(script_fds[SFD_USERTTY], 0); + } while (!n && errno == EINTR); + if (cstat->type == CMD_WSTATUS && WIFSIGNALED(cstat->val)) { int signo = WTERMSIG(cstat->val); if (signo && signo != SIGINT && signo != SIGPIPE) { @@ -696,9 +700,6 @@ script_execve(struct command_details *details, char *argv[], char *envp[], write(STDOUT_FILENO, "\n", 1); } } - do { - n = term_restore(script_fds[SFD_USERTTY], 0); - } while (!n && errno == EINTR); } return cstat->type == CMD_ERRNO ? -1 : 0;