From 70d421705c23f15188808f5435b03583bd613485 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 24 Jan 2009 15:08:43 +0100 Subject: [PATCH] Fix para_client's --loglevel option. Without this fix, para_client always used loglevel debug. --- audiod.c | 4 ++-- client.c | 3 +-- client.h | 3 ++- client_common.c | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/audiod.c b/audiod.c index a92c4e3b..dab3e3da 100644 --- 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--; - 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; - 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]); diff --git a/client.c b/client.c index fdd07b24..2123421e 100644 --- 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; - 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); - client_loglevel = get_loglevel_by_name(ct->conf.loglevel_arg); register_task(&svt); ret = schedule(&s); if (ret < 0) diff --git a/client.h b/client.h index b813f186..a7a3289b 100644 --- a/client.h +++ b/client.h @@ -76,4 +76,5 @@ struct client_task { }; 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); diff --git a/client_common.c b/client_common.c index e757a3a7..d5807e75 100644 --- a/client_common.c +++ b/client_common.c @@ -319,7 +319,8 @@ err_out: * * \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; @@ -363,7 +364,8 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr) &ct->conf, ¶ms)) 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); -- 2.39.5