]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/citserver.c
master_cleanup() is now the global shutdown/exit function
[citadel.git] / citadel / server / citserver.c
index 73ca220b5045eb1b0df5519f318da77429ed1a58..aa7e19139b22c991f94ce8631cae33b7c0601516 100644 (file)
@@ -121,7 +121,7 @@ void master_startup(void) {
 
 
 // Cleanup routine to be called when the server is shutting down.  Returns the needed exit code.
-int master_cleanup(int exitcode) {
+void master_cleanup(int exitcode) {
        static int already_cleaning_up = 0;
 
        if (already_cleaning_up) {
@@ -131,8 +131,8 @@ int master_cleanup(int exitcode) {
        }
        already_cleaning_up = 1;
 
-       // Do system-dependent stuff
-       sysdep_master_cleanup();
+       // Close the sockets
+       context_cleanup();
 
        // Close the configuration system
        shutdown_config_system();
@@ -156,13 +156,12 @@ int master_cleanup(int exitcode) {
        fflush(stdout);
        fflush(stderr);
 
-       if (restart_server != 0) {
-               exitcode = 1;
-       }
-       else if ((running_as_daemon != 0) && ((exitcode == 0))) {
+       if ((running_as_daemon != 0) && ((exitcode == 0))) {
                exitcode = CTDLEXIT_SHUTDOWN;
        }
-       return (exitcode);
+
+       ctdl_lockfile(0);
+       exit(exitcode);
 }