From 7be9024c826f524a1383bb6fd1264a1f9247b1d1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 13 Mar 2015 23:28:13 +0100 Subject: [PATCH] main: (order) parse state file later and use nm-logging Parse the state file a bit later after daemonizing and setting up logging. That way, we can use nm-logging. --- src/main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main.c b/src/main.c index 067a0cee3c..8bfc05c681 100644 --- a/src/main.c +++ b/src/main.c @@ -366,16 +366,6 @@ main (int argc, char *argv[]) } } - /* Parse the state file */ - if (!parse_state_file (global_opt.state_file, &net_enabled, &wifi_enabled, &wwan_enabled, &wimax_enabled, &error)) { - fprintf (stderr, _("State file %s parsing failed: (%d) %s\n"), - global_opt.state_file, - error ? error->code : -1, - (error && error->message) ? error->message : _("unknown")); - /* Not a hard failure */ - } - g_clear_error (&error); - if (global_opt.become_daemon && !global_opt.debug) { if (daemon (0, 0) < 0) { int saved_errno; @@ -394,6 +384,16 @@ main (int argc, char *argv[]) nm_logging_syslog_openlog (global_opt.debug); + /* Parse the state file */ + if (!parse_state_file (global_opt.state_file, &net_enabled, &wifi_enabled, &wwan_enabled, &wimax_enabled, &error)) { + nm_log_err (LOGD_CORE, "State file %s parsing failed: (%d) %s", + global_opt.state_file, + error ? error->code : -1, + (error && error->message) ? error->message : _("unknown")); + /* Not a hard failure */ + } + g_clear_error (&error); + dbus_threads_init_default (); /* Ensure that non-exported properties don't leak out, and that the