Skip to content

Commit

Permalink
fix(install): configure logging earlier
Browse files Browse the repository at this point in the history
There are log_error() and log_debug() calls in parse_argv().
  • Loading branch information
marcosfrm authored and haraldh committed May 26, 2021
1 parent 7d20559 commit 5eb24aa
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/install/dracut-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,10 @@ static int parse_argv(int argc, char *argv[])
}
}

if (arg_loglevel >= 0) {
log_set_max_level(arg_loglevel);
}

if (!kerneldir) {
struct utsname buf;
uname(&buf);
Expand Down Expand Up @@ -2002,18 +2006,14 @@ int main(int argc, char **argv)
char *path = NULL;
char *env_no_xattr = NULL;

r = parse_argv(argc, argv);
if (r <= 0)
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;

log_set_target(LOG_TARGET_CONSOLE);
log_parse_environment();

if (arg_loglevel >= 0)
log_set_max_level(arg_loglevel);

log_open();

r = parse_argv(argc, argv);
if (r <= 0)
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;

modules_loaded = hashmap_new(string_hash_func, string_compare_func);
if (arg_modalias) {
Iterator i;
Expand Down

0 comments on commit 5eb24aa

Please sign in to comment.