From b24d44cb2db12d26476504f5e98c0fc5c64b9d21 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 15 Mar 2015 16:00:36 +0100 Subject: [PATCH] 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 7fe0f349ce49500871befc7f00cac59139809fae) --- src/main.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main.c b/src/main.c index 391219e241..95d773155d 100644 --- a/src/main.c +++ b/src/main.c @@ -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) {