-/* $OpenBSD: proc.c,v 1.35 2023/03/08 04:43:04 guenther Exp $ */
+/* $OpenBSD: proc.c,v 1.36 2024/07/28 15:31:22 deraadt Exp $ */
/* $NetBSD: proc.c,v 1.9 1995/04/29 23:21:33 mycroft Exp $ */
/*-
neednote = 0;
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next) {
if (pp->p_flags & PNEEDNOTE) {
sigprocmask(SIG_BLOCK, &sigset, &osigset);
*/
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
for (pp = (fp = &proclist)->p_next; pp != NULL; pp = (fp = pp)->p_next)
if (pp->p_pid == 0) {
fp = pp;
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
for (;;) {
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, NULL);
jobflags = 0;
do
break;
sigset = osigset;
sigdelset(&sigset, SIGCHLD);
+ sigdelset(&sigset, SIGHUP);
sigsuspend(&sigset);
}
sigprocmask(SIG_SETMASK, &osigset, NULL);
pjobs++;
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
loop:
for (pp = proclist.p_next; pp; pp = pp->p_next)
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
if (setintr)
sigaddset(&sigset, SIGINT);
sigprocmask(SIG_BLOCK, &sigset, NULL);
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
np = pp;
do {
if (child == 16)
stderror(ERR_NESTING, 16);
/*
- * Hold SIGCHLD until we have the process installed in our table.
+ * Hold SIGCHLD/SIGHUP until we have the process installed in our table.
*/
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
while ((pid = fork()) == -1)
if (setintr == 0)
-/* $OpenBSD: sem.c,v 1.23 2019/06/28 13:34:58 deraadt Exp $ */
+/* $OpenBSD: sem.c,v 1.24 2024/07/28 15:31:22 deraadt Exp $ */
/* $NetBSD: sem.c,v 1.9 1995/09/27 00:38:50 jtc Exp $ */
/*-
t->t_dflg & (F_REPEAT | F_AMPERSAND) || bifunc) {
forked++;
/*
- * We need to block SIGCHLD here, so that if the process does
+ * We need to block SIGCHLD/SIGHUP here, so that if the process does
* not die before we can set the process group
*/
if (wanttty >= 0 && !nosigchld) {
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, &csigset);
nosigchld = 1;
}
if (wanttty >= 0 && !nosigchld && !noexec) {
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, &csigset);
nosigchld = 1;
}
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
+ sigaddset(&sigset, SIGHUP);
sigaddset(&sigset, SIGINT);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
ochild = child;