* Try to reach our cleanup routine when SIGSEGV is caught. Hopefully
authorArt Cancro <ajc@citadel.org>
Wed, 16 Feb 2005 18:48:39 +0000 (18:48 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 16 Feb 2005 18:48:39 +0000 (18:48 +0000)
  we'll get there and we can close the databases cleanly.

citadel/ChangeLog
citadel/citserver.c
citadel/sysdep.c

index 76fa1548156b281ae8f684d06049a80372c3b314..a9145bac33f4719bf83c933176f64ccf31a87c7e 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index aacfecfdb025e1c5a16289e6c61665477f68261c..0ff5725e990db6ccb23c327c7b3b438446a4083a 100644 (file)
@@ -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) {
index e100ec67cdb4ff5ee30beec665e1a85a74400bd6..4457591a4c8e43923db0842db166d2ef99cc9a32 100644 (file)
@@ -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