2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

suspend_sudo_pty: fix cut & pasto in last commit to catch SIGCONT.

Also set sa.sa_handler to SIG_DFL instead of SIG_IGN.  There is no
difference for SIGCONT but it means we can re-use sa as-is later.
This commit is contained in:
Todd C. Miller
2023-03-22 08:26:36 -06:00
parent 0fcbcaede0
commit acbe617fb4

View File

@@ -229,8 +229,8 @@ suspend_sudo_pty(struct exec_closure *ec, int signo)
memset(&sa, 0, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
sa.sa_handler = SIG_IGN;
if (sudo_sigaction(signo, &sa, &saved_sigcont) != 0)
sa.sa_handler = SIG_DFL;
if (sudo_sigaction(SIGCONT, &sa, &saved_sigcont) != 0)
sudo_warn(U_("unable to set handler for SIGCONT"));
switch (signo) {
@@ -275,7 +275,6 @@ suspend_sudo_pty(struct exec_closure *ec, int signo)
/* Suspend self and continue command when we resume. */
if (signo != SIGSTOP) {
sa.sa_handler = SIG_DFL;
if (sudo_sigaction(signo, &sa, &osa) != 0)
sudo_warn(U_("unable to set handler for SIG%s"), signame);
}
@@ -319,7 +318,7 @@ suspend_sudo_pty(struct exec_closure *ec, int signo)
break;
}
if (sudo_sigaction(signo, &saved_sigcont, NULL) != 0)
if (sudo_sigaction(SIGCONT, &saved_sigcont, NULL) != 0)
sudo_warn(U_("unable to restore handler for SIGCONT"));
debug_return_int(ret);