From: Art Cancro Date: Wed, 16 Feb 2005 18:48:39 +0000 (+0000) Subject: * Try to reach our cleanup routine when SIGSEGV is caught. Hopefully X-Git-Tag: v7.86~5044 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=2292e9958a61ba5aabab389a57b484a8ba083945;p=citadel.git * Try to reach our cleanup routine when SIGSEGV is caught. Hopefully we'll get there and we can close the databases cleanly. --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 76fa15481..a9145bac3 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,8 @@ $Log$ + Revision 640.9 2005/02/16 18:48:39 ajc + * Try to reach our cleanup routine when SIGSEGV is caught. Hopefully + we'll get there and we can close the databases cleanly. + Revision 640.8 2005/02/16 17:37:16 ajc * Be more aggressive about shutting down when told to. Getting the databases closed is the highest priority. @@ -6404,4 +6408,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/citserver.c b/citadel/citserver.c index aacfecfdb..0ff5725e9 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -130,6 +130,10 @@ void master_startup(void) { */ void master_cleanup(void) { struct CleanupFunctionHook *fcn; + static int already_cleaning_up = 0; + + if (already_cleaning_up) while(1) sleep(1); + already_cleaning_up = 1; /* Run any cleanup routines registered by loadable modules */ for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) { diff --git a/citadel/sysdep.c b/citadel/sysdep.c index e100ec67c..4457591a4 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -171,7 +171,7 @@ void lprintf(enum LogLevel loglevel, const char *format, ...) { volatile int time_to_die = 0; static RETSIGTYPE signal_cleanup(int signum) { - lprintf(CTDL_DEBUG, "Signal %d received.\n", signum); + lprintf(CTDL_DEBUG, "Caught signal %d; shutting down.\n", signum); time_to_die = 1; master_cleanup(); /* will this work? */ } @@ -222,6 +222,7 @@ void init_sysdep(void) { signal(SIGQUIT, signal_cleanup); signal(SIGHUP, signal_cleanup); signal(SIGTERM, signal_cleanup); + signal(SIGSEGV, signal_cleanup); /* * Do not shut down the server on broken pipe signals, otherwise the