main: (order) move run_from_build_dir check before setting up logging

Or: move setup of nm-logging immediately after it is really needed:
before setup of config.

(cherry picked from commit 7fe0f349ce)
This commit is contained in:
Thomas Haller 2015-03-15 16:00:36 +01:00
parent 06d038cd58
commit b24d44cb2d

View file

@ -289,21 +289,6 @@ main (int argc, char *argv[])
nm_main_utils_ensure_rundir ();
if (!nm_logging_setup (global_opt.opt_log_level,
global_opt.opt_log_domains,
&bad_domains,
&error)) {
fprintf (stderr,
_("%s. Please use --help to see a list of valid options.\n"),
error->message);
exit (1);
} else if (bad_domains) {
fprintf (stderr,
_("Ignoring unrecognized log domain(s) '%s' passed on command line.\n"),
bad_domains);
g_clear_pointer (&bad_domains, g_free);
}
/* When running from the build directory, determine our build directory
* base and set helper paths in the build tree */
if (global_opt.run_from_build_dir) {
@ -328,6 +313,21 @@ main (int argc, char *argv[])
g_free (path);
}
if (!nm_logging_setup (global_opt.opt_log_level,
global_opt.opt_log_domains,
&bad_domains,
&error)) {
fprintf (stderr,
_("%s. Please use --help to see a list of valid options.\n"),
error->message);
exit (1);
} else if (bad_domains) {
fprintf (stderr,
_("Ignoring unrecognized log domain(s) '%s' passed on command line.\n"),
bad_domains);
g_clear_pointer (&bad_domains, g_free);
}
/* Read the config file and CLI overrides */
config = nm_config_new (&error);
if (config == NULL) {