// 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) {
}
already_cleaning_up = 1;
- // Do system-dependent stuff
- sysdep_master_cleanup();
+ // Close the sockets
+ context_cleanup();
// Close the configuration system
shutdown_config_system();
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);
}