diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fixinc/server.c | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 574be6a..8857e6c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2000-06-02 Bruce Korb <bkorb@gnu.org> + + * fixinc/server.c(sig_handler): resume closing server on SIGPIPE + (server_setup): define the server's master pid + (close_server): actually do the deed IFF we are the server's master + 2000-06-02 Jakub Jelinek <jakub@redhat.com> * c-common.c (c_get_alias_set): Check whether signed_type did not diff --git a/gcc/fixinc/server.c b/gcc/fixinc/server.c index 598652c..eba1933 100644 --- a/gcc/fixinc/server.c +++ b/gcc/fixinc/server.c @@ -84,6 +84,7 @@ #endif STATIC volatile t_bool read_pipe_timeout; +STATIC pid_t server_master_pid = NOPROCESS; static t_pchar def_args[] = { (char *) NULL, (char *) NULL }; @@ -183,10 +184,12 @@ load_data (fp) void close_server () { - if (server_id != NULLPROCESS) + if ( (server_id != NULLPROCESS) + && (server_master_pid == getpid ())) { kill ((pid_t) server_id, SIGKILL); server_id = NULLPROCESS; + server_master_pid = NOPROCESS; fclose (server_pair.pf_read); fclose (server_pair.pf_write); server_pair.pf_read = server_pair.pf_write = (FILE *) NULL; @@ -209,8 +212,6 @@ sig_handler (signo) "fixincl ERROR: sig_handler: killed pid %ld due to %s\n", (long) server_id, signo == SIGPIPE ? "SIGPIPE" : "SIGALRM"); #endif - if (signo == SIGPIPE) - return; close_server (); read_pipe_timeout = BOOL_TRUE; } @@ -231,6 +232,8 @@ server_setup () else fputs ("NOTE: server restarted\n", stderr); + server_master_pid = getpid (); + signal (SIGPIPE, sig_handler); signal (SIGALRM, sig_handler); |