]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - server.c
Merge branch 'refs/heads/t/ubsan'
[paraslash.git] / server.c
index eee0a4128e9218233dad9e316d6cc9c1658a6cbb..09087f7a72396bf01e51782dbebc1b9d1a82eb7c 100644 (file)
--- a/server.c
+++ b/server.c
@@ -110,7 +110,7 @@ static struct signal_task *signal_task;
 /** The process id of the audio file selector process. */
 pid_t afs_pid = 0;
 
-/* The the main server process (parent of afs and the command handlers). */
+/* The main server process (parent of afs and the command handlers). */
 static pid_t server_pid;
 
 /**
@@ -298,14 +298,14 @@ static int signal_post_select(struct sched *s, __a_unused void *context)
                        if (pid != afs_pid)
                                continue;
                        PARA_EMERG_LOG("fatal: afs died\n");
-                       kill(0, SIGTERM);
-                       goto cleanup;
+                       goto genocide;
                }
                break;
        /* die on sigint/sigterm. Kill all children too. */
        case SIGINT:
        case SIGTERM:
                PARA_EMERG_LOG("terminating on signal %d\n", signum);
+genocide:
                kill(0, SIGTERM);
                /*
                 * We must wait for all of our children to die. For the afs
@@ -320,7 +320,6 @@ static int signal_post_select(struct sched *s, __a_unused void *context)
                while (wait(NULL) != -1 || errno != ECHILD)
                        ; /* still at least one child alive */
                mutex_lock(mmd_mutex);
-cleanup:
                free(mmd->afd.afhi.chunk_table);
                task_notify_all(s, E_DEADLY_SIGNAL);
                return -E_DEADLY_SIGNAL;
@@ -488,6 +487,13 @@ static void init_server_command_task(struct server_command_task *sct,
                .post_select = command_post_select,
                .context = sct,
        }, &sched);
+       /*
+        * Detect whether the abstract Unix domain socket space is supported,
+        * but do not create the socket. We check this once in server context
+        * so that the command handlers inherit this bit of information and
+        * don't need to check again.
+        */
+       create_local_socket(NULL);
        return;
 err:
        PARA_EMERG_LOG("%s\n", para_strerror(-ret));
@@ -576,9 +582,6 @@ static void server_init(int argc, char **argv, struct server_command_task *sct)
        init_ipc_or_die(); /* init mmd struct, mmd and log mutex */
        daemon_set_start_time();
        daemon_set_hooks(pre_log_hook, post_log_hook);
-       PARA_NOTICE_LOG("initializing audio format handlers\n");
-       afh_init();
-
        /*
         * Although afs uses its own signal handling we must ignore SIGUSR1
         * _before_ the afs child process gets born by init_afs() below.  It's