Fix para_client's --loglevel option.
authorAndre Noll <maan@systemlinux.org>
Sat, 24 Jan 2009 14:08:43 +0000 (15:08 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 24 Jan 2009 14:08:43 +0000 (15:08 +0100)
Without this fix, para_client always used loglevel debug.

audiod.c
client.c
client.h
client_common.c

index a92c4e3..dab3e3d 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1021,13 +1021,13 @@ static void status_pre_select(struct sched *s, struct task *t)
                int argc = 3;
                PARA_INFO_LOG("clock diff count: %d\n", st->clock_diff_count);
                st->clock_diff_count--;
                int argc = 3;
                PARA_INFO_LOG("clock diff count: %d\n", st->clock_diff_count);
                st->clock_diff_count--;
-               client_open(argc, argv, &st->ct);
+               client_open(argc, argv, &st->ct, NULL);
                set_stat_task_restart_barrier(2);
 
        } else {
                char *argv[] = {"audiod", "stat", NULL};
                int argc = 2;
                set_stat_task_restart_barrier(2);
 
        } else {
                char *argv[] = {"audiod", "stat", NULL};
                int argc = 2;
-               client_open(argc, argv, &st->ct);
+               client_open(argc, argv, &st->ct, NULL);
                set_stat_task_restart_barrier(5);
        }
        free(stat_item_values[SI_BASENAME]);
                set_stat_task_restart_barrier(5);
        }
        free(stat_item_values[SI_BASENAME]);
index fdd07b2..2123421 100644 (file)
--- a/client.c
+++ b/client.c
@@ -80,10 +80,9 @@ int main(int argc, char *argv[])
 
        s.default_timeout.tv_sec = 1;
        s.default_timeout.tv_usec = 0;
 
        s.default_timeout.tv_sec = 1;
        s.default_timeout.tv_usec = 0;
-       ret = client_open(argc, argv, &ct);
+       ret = client_open(argc, argv, &ct, &client_loglevel);
        if (ret < 0) /* can not use PARA_LOG here because ct is NULL */
                exit(EXIT_FAILURE);
        if (ret < 0) /* can not use PARA_LOG here because ct is NULL */
                exit(EXIT_FAILURE);
-       client_loglevel = get_loglevel_by_name(ct->conf.loglevel_arg);
        register_task(&svt);
        ret = schedule(&s);
        if (ret < 0)
        register_task(&svt);
        ret = schedule(&s);
        if (ret < 0)
index b813f18..a7a3289 100644 (file)
--- a/client.h
+++ b/client.h
@@ -76,4 +76,5 @@ struct client_task {
 };
 
 void client_close(struct client_task *ct);
 };
 
 void client_close(struct client_task *ct);
-int client_open(int argc, char *argv[], struct client_task **ct);
+int client_open(int argc, char *argv[], struct client_task **ct,
+               int *loglevel);
index e757a3a..d5807e7 100644 (file)
@@ -319,7 +319,8 @@ err_out:
  *
  * \return Standard.
  */
  *
  * \return Standard.
  */
-int client_open(int argc, char *argv[], struct client_task **ct_ptr)
+int client_open(int argc, char *argv[], struct client_task **ct_ptr,
+               int *loglevel)
 {
        char *home = para_homedir();
        struct stat statbuf;
 {
        char *home = para_homedir();
        struct stat statbuf;
@@ -363,7 +364,8 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr)
                        &ct->conf, &params))
                        goto out;
        }
                        &ct->conf, &params))
                        goto out;
        }
-       ret = 1;
+       if (loglevel)
+               *loglevel = get_loglevel_by_name(ct->conf.loglevel_arg);
        PARA_INFO_LOG("loglevel: %s\n", ct->conf.loglevel_arg);
        PARA_INFO_LOG("config_file: %s\n", ct->config_file);
        PARA_INFO_LOG("key_file: %s\n", ct->key_file);
        PARA_INFO_LOG("loglevel: %s\n", ct->conf.loglevel_arg);
        PARA_INFO_LOG("config_file: %s\n", ct->config_file);
        PARA_INFO_LOG("key_file: %s\n", ct->key_file);