]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - server.c
afs: Shutdown signals on exit.
[paraslash.git] / server.c
index 690f7163984c2f00cb0de1e4982da4668676e500..076bf4fabbf2b0900e759d5cf4fb1427fa18bc99 100644 (file)
--- a/server.c
+++ b/server.c
@@ -283,7 +283,7 @@ success:
                daemon_set_flag(DF_LOG_TIMING);
        daemon_set_priority(OPT_UINT32_VAL(PRIORITY));
        if (user_list_file)
-               init_user_list(user_list_file);
+               user_list_init(user_list_file);
        ret = 1;
 free_cf:
        free(cf);
@@ -505,6 +505,7 @@ static int init_afs(int argc, char **argv)
                int i;
 
                afs_pid = getpid();
+               user_list_deplete();
                for (i = argc - 1; i >= 0; i--)
                        memset(argv[i], 0, strlen(argv[i]));
                i = argc - lls_num_inputs(cmdline_lpr) - 1;
@@ -642,6 +643,21 @@ static int server_select(int max_fileno, fd_set *readfds, fd_set *writefds,
        return ret;
 }
 
+/**
+ * Deallocate all lopsub parse results.
+ *
+ * The server allocates a parse result for command line options and optionally
+ * a second parse result for the effective configuration, defined by merging
+ * the command line options with the options stored in the configuration file.
+ * This function frees both structures.
+ */
+void free_lpr(void)
+{
+       lls_free_parse_result(server_lpr, CMD_PTR);
+       if (server_lpr != cmdline_lpr)
+               lls_free_parse_result(cmdline_lpr, CMD_PTR);
+}
+
 /**
  * The main function of para_server.
  *
@@ -674,6 +690,7 @@ int main(int argc, char *argv[])
                daemon_set_hooks(NULL, NULL); /* only one process remaining */
                mutex_destroy(log_mutex);
                shm_detach(mmd);
+               deplete_close_on_fork_list();
                if (ret < 0)
                        PARA_EMERG_LOG("%s\n", para_strerror(-ret));
        } else {
@@ -683,8 +700,7 @@ int main(int argc, char *argv[])
        }
        vss_shutdown();
        shm_detach(mmd);
-       lls_free_parse_result(server_lpr, CMD_PTR);
-       if (server_lpr != cmdline_lpr)
-               lls_free_parse_result(cmdline_lpr, CMD_PTR);
+       user_list_deplete();
+       free_lpr();
        exit(ret < 0? EXIT_FAILURE : EXIT_SUCCESS);
 }