Simplify init_admissible_files().
authorAndre Noll <maan@systemlinux.org>
Wed, 24 Oct 2007 12:37:27 +0000 (14:37 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 24 Oct 2007 12:37:27 +0000 (14:37 +0200)
It now takes an arg containing the mood or playlist
to be initialized.

afs.c

diff --git a/afs.c b/afs.c
index 9d235b3..2cbb010 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -603,16 +603,10 @@ int com_select(int fd, int argc, char * const * const argv)
        return ret;
 }
 
        return ret;
 }
 
-static void init_admissible_files(void)
+static void init_admissible_files(char *arg)
 {
 {
-       int ret = 0;
-       char *arg = conf.afs_initial_mode_arg;
-       ret = activate_mood_or_playlist(arg, NULL);
-       if (ret >= 0)
-               return;
-       PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret));
-       PARA_NOTICE_LOG("defaulting to dummy mood\n");
-       activate_mood_or_playlist(NULL, NULL); /* always successful */
+       if (activate_mood_or_playlist(arg, NULL) < 0)
+               activate_mood_or_playlist(NULL, NULL); /* always successful */
 }
 
 static int setup_command_socket_or_die(void)
 }
 
 static int setup_command_socket_or_die(void)
@@ -966,7 +960,7 @@ __noreturn void afs_init(uint32_t cookie, int socket_fd)
                exit(EXIT_FAILURE);
        PARA_INFO_LOG("server_socket: %d, afs_socket_cookie: %u\n",
                server_socket, (unsigned) cookie);
                exit(EXIT_FAILURE);
        PARA_INFO_LOG("server_socket: %d, afs_socket_cookie: %u\n",
                server_socket, (unsigned) cookie);
-       init_admissible_files();
+       init_admissible_files(conf.afs_initial_mode_arg);
        register_tasks(cookie);
        s.default_timeout.tv_sec = 0;
        s.default_timeout.tv_usec = 999 * 1000;
        register_tasks(cookie);
        s.default_timeout.tv_sec = 0;
        s.default_timeout.tv_usec = 999 * 1000;