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.
This commit is contained in:
Todd C. Miller
2012-12-28 11:03:23 -05:00
parent d129290ec3
commit 782da0aa81

View File

@@ -388,11 +388,13 @@ suspend_parent(int signo)
snprintf(signame, sizeof(signame), "%d", signo);
/* Suspend self and continue command when we resume. */
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,6 +421,7 @@ suspend_parent(int signo)
}
}
if (signo != SIGSTOP)
sigaction(signo, &osa, NULL);
rval = ttymode == TERM_RAW ? SIGCONT_FG : SIGCONT_BG;
break;