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:
@@ -388,11 +388,13 @@ suspend_parent(int signo)
|
|||||||
snprintf(signame, sizeof(signame), "%d", signo);
|
snprintf(signame, sizeof(signame), "%d", signo);
|
||||||
|
|
||||||
/* Suspend self and continue command when we resume. */
|
/* Suspend self and continue command when we resume. */
|
||||||
zero_bytes(&sa, sizeof(sa));
|
if (signo != SIGSTOP) {
|
||||||
sigemptyset(&sa.sa_mask);
|
zero_bytes(&sa, sizeof(sa));
|
||||||
sa.sa_flags = SA_INTERRUPT; /* do not restart syscalls */
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_handler = SIG_DFL;
|
sa.sa_flags = SA_INTERRUPT; /* do not restart syscalls */
|
||||||
sigaction(signo, &sa, &osa);
|
sa.sa_handler = SIG_DFL;
|
||||||
|
sigaction(signo, &sa, &osa);
|
||||||
|
}
|
||||||
sudo_debug_printf(SUDO_DEBUG_INFO, "kill parent SIG%s", signame);
|
sudo_debug_printf(SUDO_DEBUG_INFO, "kill parent SIG%s", signame);
|
||||||
if (killpg(ppgrp, signo) != 0)
|
if (killpg(ppgrp, signo) != 0)
|
||||||
warning("killpg(%d, SIG%s)", (int)ppgrp, signame);
|
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;
|
rval = ttymode == TERM_RAW ? SIGCONT_FG : SIGCONT_BG;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user