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.
This commit is contained in:
20
src/main.c
20
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 (global_opt.become_daemon && !global_opt.debug) {
|
||||||
if (daemon (0, 0) < 0) {
|
if (daemon (0, 0) < 0) {
|
||||||
int saved_errno;
|
int saved_errno;
|
||||||
@@ -394,6 +384,16 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
nm_logging_syslog_openlog (global_opt.debug);
|
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 ();
|
dbus_threads_init_default ();
|
||||||
|
|
||||||
/* Ensure that non-exported properties don't leak out, and that the
|
/* Ensure that non-exported properties don't leak out, and that the
|
||||||
|
Reference in New Issue
Block a user