aboutsummaryrefslogtreecommitdiff
path: root/gcc/fixinc
diff options
context:
space:
mode:
authorBruce Korb <bkorb@gnu.org>2000-06-02 17:25:47 +0000
committerBruce Korb <korbb@gcc.gnu.org>2000-06-02 17:25:47 +0000
commit56ce79f73374a30b653e0e8f07a59fadac724783 (patch)
tree057e3ea08853759f98103b14ba7affbbe87af524 /gcc/fixinc
parentff84bb1888b6acc653c5b8edbd75740925383a9b (diff)
downloadgcc-56ce79f73374a30b653e0e8f07a59fadac724783.zip
gcc-56ce79f73374a30b653e0e8f07a59fadac724783.tar.gz
gcc-56ce79f73374a30b653e0e8f07a59fadac724783.tar.bz2
only shut down the server process if the master process is exiting
From-SVN: r34360
Diffstat (limited to 'gcc/fixinc')
-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 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);