summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-03-15 15:59:02 +0100
committerThomas Haller <thaller@redhat.com>2015-03-19 16:29:56 +0100
commit1f5723997aecadef4ebef5aa68a1312435e41fd6 (patch)
treed06b8ae1bcc1cd62099d9e5797096ec17649c19d
parente42a15226acdee5034ee190360529527a2b3731d (diff)
downloadNetworkManager-1f5723997aecadef4ebef5aa68a1312435e41fd6.tar.gz
main: (order) earlier create rundir
Create the rundir earlier and before setting up nm-logging. nm_main_utils_ensure_rundir() errors out with fprintf(stderr) and does not need nm-logging.
-rw-r--r--src/main.c16
-rw-r--r--src/nm-iface-helper.c4
2 files changed, 10 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index 0e08410c3f..73cb7acead 100644
--- a/src/main.c
+++ b/src/main.c
@@ -287,6 +287,14 @@ main (int argc, char *argv[])
nm_main_utils_ensure_not_running_pidfile (global_opt.pidfile, "NetworkManager");
+ /* Ensure state directory exists */
+ if (g_mkdir_with_parents (NMSTATEDIR, 0755) != 0) {
+ fprintf (stderr, "Cannot create '%s': %s", NMSTATEDIR, strerror (errno));
+ exit (1);
+ }
+
+ nm_main_utils_ensure_rundir ();
+
if (!nm_logging_setup (global_opt.opt_log_level,
global_opt.opt_log_domains,
&bad_domains,
@@ -326,14 +334,6 @@ main (int argc, char *argv[])
g_free (path);
}
- /* Ensure state directory exists */
- if (g_mkdir_with_parents (NMSTATEDIR, 0755) != 0) {
- nm_log_err (LOGD_CORE, "Cannot create '%s': %s", NMSTATEDIR, strerror (errno));
- exit (1);
- }
-
- nm_main_utils_ensure_rundir ();
-
/* Read the config file and CLI overrides */
config = nm_config_setup (config_cli, &error);
nm_config_cmd_line_options_free (config_cli);
diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c
index 5598602551..c8bad7879b 100644
--- a/src/nm-iface-helper.c
+++ b/src/nm-iface-helper.c
@@ -386,6 +386,8 @@ main (int argc, char *argv[])
pidfile = g_strdup_printf (NMIH_PID_FILE_FMT, ifindex);
nm_main_utils_ensure_not_running_pidfile (pidfile, "nm-iface-helper");
+ nm_main_utils_ensure_rundir ();
+
if (!nm_logging_setup (global_opt.opt_log_level,
global_opt.opt_log_domains,
&bad_domains,
@@ -401,8 +403,6 @@ main (int argc, char *argv[])
g_clear_pointer (&bad_domains, g_free);
}
- nm_main_utils_ensure_rundir ();
-
if (global_opt.become_daemon && !global_opt.debug) {
if (daemon (0, 0) < 0) {
int saved_errno;