aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1992-10-13 11:24:57 -0700
committerJim Wilson <wilson@gcc.gnu.org>1992-10-13 11:24:57 -0700
commit915ee6237119145c18a9bf48e2f20ed18691c644 (patch)
tree538d7e0a40b436dcd7e995d538086863e56b1f4e
parentbc9c7a369c5bec408f4c615390264e76db8dc1b7 (diff)
downloadgcc-915ee6237119145c18a9bf48e2f20ed18691c644.zip
gcc-915ee6237119145c18a9bf48e2f20ed18691c644.tar.gz
gcc-915ee6237119145c18a9bf48e2f20ed18691c644.tar.bz2
(main): Only install a signal handler for signals that already have handlers.
(main): Only install a signal handler for signals that already have handlers. (fork_execute): Don't ignore signals before calling do_wait. From-SVN: r2436
-rw-r--r--gcc/collect2.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c
index e53a078..95f3a68 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -493,12 +493,18 @@ main (argc, argv)
if (argc < 2)
fatal ("no arguments");
- signal (SIGQUIT, handler);
- signal (SIGINT, handler);
- signal (SIGALRM, handler);
- signal (SIGHUP, handler);
- signal (SIGSEGV, handler);
- signal (SIGBUS, handler);
+ if (signal (SIGQUIT, SIG_IGN) != SIG_IGN)
+ signal (SIGQUIT, handler);
+ if (signal (SIGINT, SIG_IGN) != SIG_IGN)
+ signal (SIGINT, handler);
+ if (signal (SIGALRM, SIG_IGN) != SIG_IGN)
+ signal (SIGALRM, handler);
+ if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
+ signal (SIGHUP, handler);
+ if (signal (SIGSEGV, SIG_IGN) != SIG_IGN)
+ signal (SIGSEGV, handler);
+ if (signal (SIGBUS, SIG_IGN) != SIG_IGN)
+ signal (SIGBUS, handler);
/* Try to discover a valid linker/assembler/nm/strip to use. */
len = strlen (argv[0]);
@@ -886,8 +892,6 @@ fork_execute (prog, argv)
char **argv;
{
int pid;
- void (*int_handler) ();
- void (*quit_handler) ();
if (vflag || debug)
{
@@ -914,13 +918,7 @@ fork_execute (prog, argv)
fatal_perror ("executing %s", prog);
}
- int_handler = (void (*) ())signal (SIGINT, SIG_IGN);
- quit_handler = (void (*) ())signal (SIGQUIT, SIG_IGN);
-
do_wait (prog);
-
- signal (SIGINT, int_handler);
- signal (SIGQUIT, quit_handler);
}