about summary refs log tree commit diff
path: root/src/main-utils.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2017-01-17 20:25:09 +0100
committerMichael Biebl <biebl@debian.org>2017-01-17 20:25:09 +0100
commit58f8be580039b0575b197b9573a1c92745d96d30 (patch)
tree2c226233f623a0dcb529be0eb8cdf97e4a2ae0c0 /src/main-utils.c
parent45cb5bb3c0e6edb887cf69b417fcaf7053814a9b (diff)
New upstream version 1.5.90 upstream/1.5.90
Diffstat (limited to 'src/main-utils.c')
-rw-r--r--src/main-utils.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main-utils.c b/src/main-utils.c
index 6497ea25..9e3aa7bd 100644
--- a/src/main-utils.c
+++ b/src/main-utils.c
@@ -34,6 +34,7 @@
 
 #include "main-utils.h"
 #include "NetworkManagerUtils.h"
+#include "nm-config.h"
 
 static gboolean
 sighup_handler (gpointer user_data)
@@ -139,11 +140,23 @@ nm_main_utils_ensure_statedir ()
 void
 nm_main_utils_ensure_rundir ()
 {
+	int errsv;
+
 	/* Setup runtime directory */
 	if (g_mkdir_with_parents (NMRUNDIR, 0755) != 0) {
-		fprintf (stderr, _("Cannot create '%s': %s"), NMRUNDIR, strerror (errno));
+		errsv = errno;
+		fprintf (stderr, _("Cannot create '%s': %s"), NMRUNDIR, g_strerror (errsv));
 		exit (1);
 	}
+
+	nm_assert (g_str_has_prefix (NM_CONFIG_DEVICE_STATE_DIR, NMRUNDIR"/"));
+	if (g_mkdir (NM_CONFIG_DEVICE_STATE_DIR, 0755) != 0) {
+		errsv = errno;
+		if (errsv != EEXIST) {
+			fprintf (stderr, _("Cannot create '%s': %s"), NM_CONFIG_DEVICE_STATE_DIR, g_strerror (errsv));
+			exit (1);
+		}
+	}
 }
 
 /**