Fix use of uninitialized afhi->header_len.
[paraslash.git] / audiod.c
index 701f827848b112b735e3fa16cae371934200e8a8..6fd8eef15a5b3c5f0c07c16795155daa63691ddc 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -144,6 +144,8 @@ void para_log(int ll, const char* fmt,...)
 
        if (ll < conf.loglevel_arg)
                return;
+       if (!logfile && conf.daemon_given)
+               return;
        if (!hostname)
                hostname = para_hostname();
        outfd = logfile? logfile : stderr;
@@ -599,6 +601,8 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t)
                a = &afi[sl->format];
                if (!sl->receiver_node)
                        continue;
+               if ((!a->num_filters || sl->fc) && sl->wng)
+                       continue; /* everything already started */
                if (!a->num_filters) {
                        if (sl->receiver_node->loaded && !sl->wng) {
                                open_writers(i);
@@ -611,7 +615,7 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t)
                        s->timeout = min_delay;
                        continue;
                }
-               if (!sl->fc || !*sl->fc->out_loaded || sl->wng)
+               if (sl->wng || !sl->fc || !*sl->fc->out_loaded)
                        continue;
                if (tv_diff(now, &initial_delay_barrier, &diff) > 0) {
                        open_writers(i);
@@ -1105,7 +1109,7 @@ static void set_initial_status(void)
                return;
        }
        if (strcmp(conf.mode_arg, "on"))
-               PARA_WARNING_LOG("%s", "invalid mode\n");
+               PARA_WARNING_LOG("invalid mode\n");
 }
 
 /**
@@ -1140,7 +1144,7 @@ int main(int argc, char *argv[])
 
                };
                if (audiod_cmdline_parser_config_file(config_file, &conf, &params)) {
-                       PARA_EMERG_LOG("%s", "parse error in config file\n");
+                       PARA_EMERG_LOG("parse error in config file\n");
                        exit(EXIT_FAILURE);
                }
                free(config_file);