only shut down the server process if the master process is exiting

From-SVN: r34360
This commit is contained in:
Bruce Korb 2000-06-02 17:25:47 +00:00 committed by Bruce Korb
parent ff84bb1888
commit 56ce79f733
2 changed files with 12 additions and 3 deletions

View File

@ -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> 2000-06-02 Jakub Jelinek <jakub@redhat.com>
* c-common.c (c_get_alias_set): Check whether signed_type did not * c-common.c (c_get_alias_set): Check whether signed_type did not

View File

@ -84,6 +84,7 @@
#endif #endif
STATIC volatile t_bool read_pipe_timeout; STATIC volatile t_bool read_pipe_timeout;
STATIC pid_t server_master_pid = NOPROCESS;
static t_pchar def_args[] = static t_pchar def_args[] =
{ (char *) NULL, (char *) NULL }; { (char *) NULL, (char *) NULL };
@ -183,10 +184,12 @@ load_data (fp)
void void
close_server () close_server ()
{ {
if (server_id != NULLPROCESS) if ( (server_id != NULLPROCESS)
&& (server_master_pid == getpid ()))
{ {
kill ((pid_t) server_id, SIGKILL); kill ((pid_t) server_id, SIGKILL);
server_id = NULLPROCESS; server_id = NULLPROCESS;
server_master_pid = NOPROCESS;
fclose (server_pair.pf_read); fclose (server_pair.pf_read);
fclose (server_pair.pf_write); fclose (server_pair.pf_write);
server_pair.pf_read = server_pair.pf_write = (FILE *) NULL; 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", "fixincl ERROR: sig_handler: killed pid %ld due to %s\n",
(long) server_id, signo == SIGPIPE ? "SIGPIPE" : "SIGALRM"); (long) server_id, signo == SIGPIPE ? "SIGPIPE" : "SIGALRM");
#endif #endif
if (signo == SIGPIPE)
return;
close_server (); close_server ();
read_pipe_timeout = BOOL_TRUE; read_pipe_timeout = BOOL_TRUE;
} }
@ -231,6 +232,8 @@ server_setup ()
else else
fputs ("NOTE: server restarted\n", stderr); fputs ("NOTE: server restarted\n", stderr);
server_master_pid = getpid ();
signal (SIGPIPE, sig_handler); signal (SIGPIPE, sig_handler);
signal (SIGALRM, sig_handler); signal (SIGALRM, sig_handler);