From e7add58aad1bb5eca28360c9c7a1a3956261c7df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Thu, 6 Dec 2012 16:33:52 +0100 Subject: [PATCH] main: ensure NMSTATEDIR exists (bgo #689744) For OSTree/gnome-ostree, the model chosen for /var is that services are responsible for creating any data they need in /var at runtime. Call g_mkdir_with_parents() to ensure NMSTATEDIR exists. https://bugzilla.gnome.org/show_bug.cgi?id=689744 Based on Colin Walters' patch. --- src/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.c b/src/main.c index a9500750f8..f70fba6c11 100644 --- a/src/main.c +++ b/src/main.c @@ -435,6 +435,12 @@ main (int argc, char *argv[]) exit (1); } + /* 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); + } + pidfile = pidfile ? pidfile : g_strdup (NM_DEFAULT_PID_FILE); state_file = state_file ? state_file : g_strdup (NM_DEFAULT_SYSTEM_STATE_FILE);