summaryrefslogtreecommitdiff
path: root/gcc/fixinc/server.c
diff options
context:
space:
mode:
authorkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-02 17:25:47 +0000
committerkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-02 17:25:47 +0000
commit6a6cdcc46e002d8fbba3000cd4ceca3a60860fab (patch)
tree057e3ea08853759f98103b14ba7affbbe87af524 /gcc/fixinc/server.c
parent40d86de911c36d5b10fb37fb6e7df1cbed5f81e1 (diff)
downloadgcc-6a6cdcc46e002d8fbba3000cd4ceca3a60860fab.tar.gz
only shut down the server process if the master process is exiting
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34360 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixinc/server.c')
-rw-r--r--gcc/fixinc/server.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/fixinc/server.c b/gcc/fixinc/server.c
index 598652c4eb9..eba1933455e 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);