Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Actually, the issue with bash (in previous) is more l...



details:   https://anonhg.NetBSD.org/src/rev/c1f28619ecf6
branches:  trunk
changeset: 744574:c1f28619ecf6
user:      kre <kre%NetBSD.org@localhost>
date:      Thu Feb 06 20:08:28 2020 +0000

description:
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

diffstat:

 bin/sh/main.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r d3aa942d6d42 -r c1f28619ecf6 bin/sh/main.c
--- a/bin/sh/main.c     Thu Feb 06 19:53:10 2020 +0000
+++ b/bin/sh/main.c     Thu Feb 06 20:08:28 2020 +0000
@@ -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 @@
 #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 @@
        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 @@
         * 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();



Home | Main Index | Thread Index | Old Index