This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
OK? -- More protection against SIGCHLD brokenness
- To: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Subject: OK? -- More protection against SIGCHLD brokenness
- From: Bruce Korb <bkorb at allegronetworks dot com>
- Date: Fri, 9 Mar 2001 19:35:11 -0800
2001-03-10 Bruce Korb <bkorb@gnu.org>
* gcc.c(main): make more rigorous
* collect2.c(main): guard against ignoring SIGCHLD
* protoize.c(main): ditto
* gcc/fixinc/fixincl.c(initialize): ditto
Index: gcc/collect2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/collect2.c,v
retrieving revision 1.107
diff -u -r1.107 collect2.c
--- collect2.c 2001/01/25 20:12:30 1.107
+++ collect2.c 2001/03/10 03:31:18
@@ -29,6 +29,9 @@
#include "config.h"
#include "system.h"
#include <signal.h>
+#if ! defined( SIGCHLD ) && defined( SIGCLD )
+# define SIGCHLD SIGCLD
+#endif
#ifdef vfork /* Autoconf may define this to fork for us. */
# define VFORK_STRING "fork"
@@ -867,6 +870,12 @@
#if defined (COLLECT2_HOST_INITIALIZATION)
/* Perform system dependent initialization, if neccessary. */
COLLECT2_HOST_INITIALIZATION;
+#endif
+
+#ifdef SIGCHLD
+ /* We *MUST* set SIGCHLD to SIG_DFL so that the wait4() call will
+ receive the signal. A different setting is inheritable */
+ signal (SIGCHLD, SIG_DFL);
#endif
/* LC_CTYPE determines the character set used by the terminal so it has be
set
Index: gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.215
diff -u -r1.215 gcc.c
--- gcc.c 2001/03/08 23:33:58 1.215
+++ gcc.c 2001/03/10 03:31:21
@@ -73,6 +73,9 @@
#include "config.h"
#include "system.h"
#include <signal.h>
+#if ! defined( SIGCHLD ) && defined( SIGCLD )
+# define SIGCHLD SIGCLD
+#endif
#include "obstack.h"
#include "intl.h"
#include "prefix.h"
@@ -5517,9 +5520,11 @@
if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
signal (SIGPIPE, fatal_error);
#endif
+#ifdef SIGCHLD
/* We *MUST* set SIGCHLD to SIG_DFL so that the wait4() call will
receive the signal. A different setting is inheritable */
signal (SIGCHLD, SIG_DFL);
+#endif
argbuf_length = 10;
argbuf = (const char **) xmalloc (argbuf_length * sizeof (const char *));
Index: gcc/protoize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/protoize.c,v
retrieving revision 1.56
diff -u -r1.56 protoize.c
--- protoize.c 2000/12/17 14:35:04 1.56
+++ protoize.c 2001/03/10 03:31:23
@@ -25,6 +25,9 @@
#include <setjmp.h>
#include <signal.h>
+#if ! defined( SIGCHLD ) && defined( SIGCLD )
+# define SIGCHLD SIGCLD
+#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -4582,6 +4585,12 @@
}
#endif
pname = pname ? pname+1 : argv[0];
+
+#ifdef SIGCHLD
+ /* We *MUST* set SIGCHLD to SIG_DFL so that the wait4() call will
+ receive the signal. A different setting is inheritable */
+ signal (SIGCHLD, SIG_DFL);
+#endif
/* LC_CTYPE determines the character set used by the terminal so it has be
set
to output messages correctly. */
Index: gcc/fixinc/fixincl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/fixincl.c,v
retrieving revision 1.51
diff -u -r1.51 fixincl.c
--- fixincl.c 2001/03/02 21:41:37 1.51
+++ fixincl.c 2001/03/10 03:31:25
@@ -29,6 +29,9 @@
#endif
#include <signal.h>
+#if ! defined( SIGCHLD ) && defined( SIGCLD )
+# define SIGCHLD SIGCLD
+#endif
#ifndef SEPARATE_FIX_PROC
#include "server.h"
#endif
@@ -248,6 +251,12 @@
fputs ("fixincl ERROR: too many command line arguments\n", stderr);
exit (EXIT_FAILURE);
}
+
+#ifdef SIGCHLD
+ /* We *MUST* set SIGCHLD to SIG_DFL so that the wait4() call will
+ receive the signal. A different setting is inheritable */
+ signal (SIGCHLD, SIG_DFL);
+#endif
#define _ENV_(v,m,n,t) { tSCC var[] = n; \
v = getenv (var); if (m && (v == NULL)) { \