Module Name:    src
Committed By:   kre
Date:           Thu Feb  6 20:08:28 UTC 2020

Modified Files:
        src/bin/sh: main.c

Log Message:
Actually, the issue with bash (in previous) is more likely that the
SIGCHLD is blocked rather than ignored.   We want neither.   Make sure
SIGCHLD is unblocked as well as SIG_DFL.

XXX pullup -9


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/bin/sh/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/main.c
diff -u src/bin/sh/main.c:1.83 src/bin/sh/main.c:1.84
--- src/bin/sh/main.c:1.83	Thu Feb  6 19:51:59 2020
+++ src/bin/sh/main.c	Thu Feb  6 20:08:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.83 2020/02/06 19:51:59 kre Exp $	*/
+/*	$NetBSD: main.c,v 1.84 2020/02/06 20:08:28 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.7 (Berkeley) 7/19/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.83 2020/02/06 19:51:59 kre Exp $");
+__RCSID("$NetBSD: main.c,v 1.84 2020/02/06 20:08:28 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -108,6 +108,7 @@ main(int argc, char **argv)
 	char *shinit;
 	uid_t uid;
 	gid_t gid;
+	sigset_t sigs;
 
 	/*
 	 * If we happen to be invoked with SIGCHLD ignored, we cannot
@@ -117,6 +118,12 @@ main(int argc, char **argv)
 	 * footpath for someone else to fall into...
 	 */
 	(void)signal(SIGCHLD, SIG_DFL);
+	/*
+	 * Similarly, SIGCHLD must not be blocked
+	 */
+	sigemptyset(&sigs);
+	sigaddset(&sigs, SIGCHLD);
+	sigprocmask(SIG_UNBLOCK, &sigs, NULL);
 
 	uid = getuid();
 	gid = getgid();

Reply via email to