From 8fedcd853eea3cd3ceb31529c5b02243024d5f78 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 11 Mar 1996 20:38:29 +0000 Subject: [PATCH] Fix bug: subprocesses were being started with SIGPIPE set to SIG_IGN. Some programs, notably gzip, depend on SIGPIPE being set to SIG_DFL (and don't bother to force this true themselves). --- v7/src/microcode/uxproc.c | 22 +++++----------------- v7/src/microcode/uxsig.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/v7/src/microcode/uxproc.c b/v7/src/microcode/uxproc.c index cc12a1fab..8287e92de 100644 --- a/v7/src/microcode/uxproc.c +++ b/v7/src/microcode/uxproc.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: uxproc.c,v 1.18 1993/11/23 03:30:24 cph Exp $ +$Id: uxproc.c,v 1.19 1996/03/11 20:38:24 cph Exp $ -Copyright (c) 1990-93 Massachusetts Institute of Technology +Copyright (c) 1990-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -47,6 +47,7 @@ extern void EXFUN extern void EXFUN ((*stop_signal_hook), (int signo)); extern void EXFUN (stop_signal_default, (int signo)); extern int EXFUN (OS_ctty_fd, (void)); +extern void EXFUN (UX_initialize_child_signals, (void)); static void EXFUN (subprocess_death, (pid_t pid, wait_status_t * status)); static void EXFUN (stop_signal_handler, (int signo)); @@ -412,21 +413,8 @@ DEFUN (OS_make_subprocess, } } - /* Force the signal mask to be empty. */ -#ifdef HAVE_POSIX_SIGNALS - { - sigset_t empty_mask; - UX_sigemptyset (&empty_mask); - UX_sigprocmask (SIG_SETMASK, (&empty_mask), 0); - } -#else -#ifdef HAVE_SYSV3_SIGNALS - /* We could do something more here, but it is hard to enumerate all - the possible signals. Instead, just release SIGCHLD, which we - know was held above before the child was spawned. */ - UX_sigrelse (SIGCHLD); -#endif -#endif + /* Put the signal mask and handlers in a normal state. */ + UX_initialize_child_signals (); /* Start the process. */ execve (filename, argv, envp); diff --git a/v7/src/microcode/uxsig.c b/v7/src/microcode/uxsig.c index 8eac58b4e..193a21ea2 100644 --- a/v7/src/microcode/uxsig.c +++ b/v7/src/microcode/uxsig.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: uxsig.c,v 1.31 1994/05/03 08:01:16 cph Exp $ +$Id: uxsig.c,v 1.32 1996/03/11 20:38:29 cph Exp $ -Copyright (c) 1990-94 Massachusetts Institute of Technology +Copyright (c) 1990-96 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -691,6 +691,32 @@ DEFUN_VOID (UX_initialize_signals) } } } + +/* Initialize the signals in a child subprocess. */ + +void +DEFUN_VOID (UX_initialize_child_signals) +{ + /* Force the signal mask to be empty. */ +#ifdef HAVE_POSIX_SIGNALS + { + sigset_t empty_mask; + UX_sigemptyset (&empty_mask); + UX_sigprocmask (SIG_SETMASK, (&empty_mask), 0); + } +#else +#ifdef HAVE_SYSV3_SIGNALS + /* We could do something more here, but it is hard to enumerate all + the possible signals. Instead, just release SIGCHLD, which we + know was held before the child was spawned. */ + UX_sigrelse (SIGCHLD); +#endif +#endif + + /* SIGPIPE was ignored above; we must set it back to the default + because some programs depend on this. */ + INSTALL_HANDLER (SIGPIPE, SIG_DFL); +} /* Interactive Interrupt Handler */ -- 2.25.1