From: Todd C. Miller Date: Fri, 28 Dec 2012 16:03:23 +0000 (-0500) Subject: No need to restore default signal handler for SIGSTOP as it is not X-Git-Tag: SUDO_1_8_7~1^2~294 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=782da0aa810bc23515db9be569035917d99c5308;p=sudo No need to restore default signal handler for SIGSTOP as it is not catchable. Attempting to do so is harmless but sigaction() will fail and set errno to EINVAL which makes it looks like there is an error. --- diff --git a/src/exec_pty.c b/src/exec_pty.c index 403928360..a80dbb20d 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -388,11 +388,13 @@ suspend_parent(int signo) snprintf(signame, sizeof(signame), "%d", signo); /* Suspend self and continue command when we resume. */ - zero_bytes(&sa, sizeof(sa)); - sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_INTERRUPT; /* do not restart syscalls */ - sa.sa_handler = SIG_DFL; - sigaction(signo, &sa, &osa); + if (signo != SIGSTOP) { + zero_bytes(&sa, sizeof(sa)); + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_INTERRUPT; /* do not restart syscalls */ + sa.sa_handler = SIG_DFL; + sigaction(signo, &sa, &osa); + } sudo_debug_printf(SUDO_DEBUG_INFO, "kill parent SIG%s", signame); if (killpg(ppgrp, signo) != 0) warning("killpg(%d, SIG%s)", (int)ppgrp, signame); @@ -419,7 +421,8 @@ suspend_parent(int signo) } } - sigaction(signo, &osa, NULL); + if (signo != SIGSTOP) + sigaction(signo, &osa, NULL); rval = ttymode == TERM_RAW ? SIGCONT_FG : SIGCONT_BG; break; }