From 3d481d1cc7688f8cf4a5ed63d38f237a87802b0e Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 17 Mar 2018 23:29:12 +0100 Subject: [PATCH] client: Fix loglevel setting. If --loglevel is given in the config file but not at the command line, the value from the config file should be used. However, currently we use the default value in this case. Moreover, client_parse_config() sets the loglevel *after* it already printed some log messages. This commit changes client_parse_config() to initialize the loglevel pointer right after the command line and config file options have been merged. --- client_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client_common.c b/client_common.c index 97d29f8f..fce5483a 100644 --- a/client_common.c +++ b/client_common.c @@ -536,7 +536,6 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, ret = lls(lls_parse(argc, argv, cmd, &lpr, &errctx)); if (ret < 0) goto out; - ll = CLIENT_OPT_UINT32_VAL(LOGLEVEL, lpr); version_handle_flag("client", CLIENT_OPT_GIVEN(VERSION, lpr)); handle_help_flag(lpr); @@ -573,6 +572,9 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, lpr = merged_lpr; } /* success */ + ll = CLIENT_OPT_UINT32_VAL(LOGLEVEL, lpr); + if (loglevel) + *loglevel = ll; user = CLIENT_OPT_GIVEN(USER, lpr)? para_strdup(CLIENT_OPT_STRING_VAL(USER, lpr)) : para_logname(); @@ -596,8 +598,6 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, ct->config_file = cf; ct->user = user; *ct_ptr = ct; - if (loglevel) - *loglevel = ll; ret = lls_num_inputs(lpr); out: free(home); -- 2.39.2