Skip to content

Commit 5eb24aa

Browse files
marcosfrmharaldh
authored andcommitted
fix(install): configure logging earlier
There are log_error() and log_debug() calls in parse_argv().
1 parent 7d20559 commit 5eb24aa

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/install/dracut-install.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,10 @@ static int parse_argv(int argc, char *argv[])
11661166
}
11671167
}
11681168

1169+
if (arg_loglevel >= 0) {
1170+
log_set_max_level(arg_loglevel);
1171+
}
1172+
11691173
if (!kerneldir) {
11701174
struct utsname buf;
11711175
uname(&buf);
@@ -2002,18 +2006,14 @@ int main(int argc, char **argv)
20022006
char *path = NULL;
20032007
char *env_no_xattr = NULL;
20042008

2005-
r = parse_argv(argc, argv);
2006-
if (r <= 0)
2007-
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
2008-
20092009
log_set_target(LOG_TARGET_CONSOLE);
20102010
log_parse_environment();
2011-
2012-
if (arg_loglevel >= 0)
2013-
log_set_max_level(arg_loglevel);
2014-
20152011
log_open();
20162012

2013+
r = parse_argv(argc, argv);
2014+
if (r <= 0)
2015+
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
2016+
20172017
modules_loaded = hashmap_new(string_hash_func, string_compare_func);
20182018
if (arg_modalias) {
20192019
Iterator i;

0 commit comments

Comments
 (0)