summaryrefslogtreecommitdiff
path: root/usr.bin/script/script.c
diff options
context:
space:
mode:
authorhgutch <hgutch@NetBSD.org>2023-05-09 15:43:39 +0000
committerhgutch <hgutch@NetBSD.org>2023-05-09 15:43:39 +0000
commit24f9b30fec4205b19aed95a21f634d87e1eeeea7 (patch)
treec5fae59ae38a3c37a6f6ac886f08203e6a09189f /usr.bin/script/script.c
parenta31b19a80461b06155e6322d5a3f0c07d8ebc73c (diff)
Reset SIGCHLD handler to SIG_DFL.
If run with "-c", both child and parent script processes will handle SIGCHLD resulting in a possible duplicate "Script done" line in the output. This fixes bin/54514.
Diffstat (limited to 'usr.bin/script/script.c')
-rw-r--r--usr.bin/script/script.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c
index 275a0de951e..1adcd86273b 100644
--- a/usr.bin/script/script.c
+++ b/usr.bin/script/script.c
@@ -1,4 +1,4 @@
-/* $NetBSD: script.c,v 1.33 2022/02/13 19:40:14 christos Exp $ */
+/* $NetBSD: script.c,v 1.34 2023/05/09 15:43:39 hgutch Exp $ */
/*
* Copyright (c) 1980, 1992, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1992, 1993\
#if 0
static char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: script.c,v 1.33 2022/02/13 19:40:14 christos Exp $");
+__RCSID("$NetBSD: script.c,v 1.34 2023/05/09 15:43:39 hgutch Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -192,6 +192,7 @@ main(int argc, char *argv[])
fail();
}
if (child == 0) {
+ (void)xsignal(SIGCHLD, SIG_DFL);
subchild = child = fork();
if (child == -1) {
warn("fork");