]> granicus.if.org Git - sudo/commitdiff
Print signal info after restoring the tty mode, not before.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 29 Apr 2010 20:52:50 +0000 (16:52 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 29 Apr 2010 20:52:50 +0000 (16:52 -0400)
src/script.c

index 0e3dec175b9d761874fb7be7da8a12bf9700f606..5ce0b4236405784a53794f1330f6559a1034d3bb 100644 (file)
@@ -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;