mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 02:00:14 +01:00
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.
(cherry picked from commit 49cfe64874)
This commit is contained in:
parent
ba054666f0
commit
06d038cd58
2 changed files with 10 additions and 10 deletions
16
src/main.c
16
src/main.c
|
|
@ -281,6 +281,14 @@ main (int argc, char *argv[])
|
|||
|
||||
nm_main_utils_ensure_not_running_pidfile (global_opt.pidfile);
|
||||
|
||||
/* 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,
|
||||
|
|
@ -320,14 +328,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_new (&error);
|
||||
if (config == NULL) {
|
||||
|
|
|
|||
|
|
@ -389,6 +389,8 @@ main (int argc, char *argv[])
|
|||
pidfile = g_strdup_printf (NMIH_PID_FILE_FMT, ifindex);
|
||||
nm_main_utils_ensure_not_running_pidfile (pidfile);
|
||||
|
||||
nm_main_utils_ensure_rundir ();
|
||||
|
||||
if (!nm_logging_setup (global_opt.opt_log_level,
|
||||
global_opt.opt_log_domains,
|
||||
&bad_domains,
|
||||
|
|
@ -404,8 +406,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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue