Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh If we are invoked with SIGCHLD ignored, we fail badly...
details: https://anonhg.NetBSD.org/src/rev/79b6bff976f2
branches: trunk
changeset: 744571:79b6bff976f2
user: kre <kre%NetBSD.org@localhost>
date: Thu Feb 06 19:51:59 2020 +0000
description:
If we are invoked with SIGCHLD ignored, we fail badly, as we assume
that we can always wait(2) for our children, and an ignored SIGCHLD
prevents that. Recent versions of bash can be convinced (due to a
bug most likely) to invoke us that way. Always return SIGCHLD to
SIG_DFL during init - we already prevent scripts from fiddling it.
All ash derived shells apparently have this problem (observed by
Martijn Dekker, and notified on the bash-bug list). Actual issue
diagnosed by Harald van Dijk (same list).
diffstat:
bin/sh/main.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r 12754cf2a731 -r 79b6bff976f2 bin/sh/main.c
--- a/bin/sh/main.c Thu Feb 06 19:50:04 2020 +0000
+++ b/bin/sh/main.c Thu Feb 06 19:51:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.82 2019/02/09 09:33:20 kre Exp $ */
+/* $NetBSD: main.c,v 1.83 2020/02/06 19:51:59 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.82 2019/02/09 09:33:20 kre Exp $");
+__RCSID("$NetBSD: main.c,v 1.83 2020/02/06 19:51:59 kre Exp $");
#endif
#endif /* not lint */
@@ -109,6 +109,15 @@
uid_t uid;
gid_t gid;
+ /*
+ * If we happen to be invoked with SIGCHLD ignored, we cannot
+ * successfully do almost anything. Perhaps we should remember
+ * its state and pass it on ignored to children if it was ignored
+ * on entry, but that seems like just leaving the shit on the
+ * footpath for someone else to fall into...
+ */
+ (void)signal(SIGCHLD, SIG_DFL);
+
uid = getuid();
gid = getgid();
Home |
Main Index |
Thread Index |
Old Index