From: Todd C. Miller Date: Thu, 12 Jan 2012 19:52:07 +0000 (-0500) Subject: Catch common signals in the monitor process so they get passed to X-Git-Tag: SUDO_1_7_9~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0a480f72a3de079b55e1dac848b930d8bc2f0dc;p=sudo Catch common signals in the monitor process so they get passed to the command. Fixes a problem when the entire login session is killed when ssh is disconnected or the terminal window is closed. --HG-- branch : 1.7 --- diff --git a/exec_pty.c b/exec_pty.c index 37c4e31bd..7a47ccb70 100644 --- a/exec_pty.c +++ b/exec_pty.c @@ -733,6 +733,17 @@ exec_monitor(path, argv, envp, backchannel, rbac) sa.sa_handler = handler; sigaction(SIGCHLD, &sa, NULL); + /* Catch common signals so we can cleanup properly. */ + sa.sa_flags = SA_RESTART; + sa.sa_handler = handler; + sigaction(SIGHUP, &sa, NULL); + sigaction(SIGINT, &sa, NULL); + sigaction(SIGQUIT, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); + sigaction(SIGTSTP, &sa, NULL); + sigaction(SIGUSR1, &sa, NULL); + sigaction(SIGUSR2, &sa, NULL); + /* * Start a new session with the parent as the session leader * and the slave pty as the controlling terminal.