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.
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);
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();
ct->config_file = cf;
ct->user = user;
*ct_ptr = ct;
- if (loglevel)
- *loglevel = ll;
ret = lls_num_inputs(lpr);
out:
free(home);