From: Andre Noll Date: Sat, 17 Mar 2018 22:29:12 +0000 (+0100) Subject: client: Fix loglevel setting. X-Git-Tag: v0.6.2~30 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=3d481d1cc7688f8cf4a5ed63d38f237a87802b0e;p=paraslash.git 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. --- 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);