summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/session_policy_local.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/session_policy_local.c b/plugins/session_policy_local.c
index 7fa3166a..11b16652 100644
--- a/plugins/session_policy_local.c
+++ b/plugins/session_policy_local.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <string.h>
#include <sys/inotify.h>
+#include <sys/stat.h>
#include <glib.h>
@@ -40,6 +41,9 @@
#define POLICYDIR STORAGEDIR "/session_policy_local"
+#define MODE (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | \
+ S_IXGRP | S_IROTH | S_IXOTH)
+
static DBusConnection *connection;
static GHashTable *policy_hash;
@@ -464,6 +468,14 @@ static int session_policy_local_init(void)
{
int err;
+ /* If the dir doesn't exist, create it */
+ if (g_file_test(POLICYDIR, G_FILE_TEST_IS_DIR) == FALSE) {
+ if (mkdir(POLICYDIR, MODE) < 0) {
+ if (errno != EEXIST)
+ return -errno;
+ }
+ }
+
connection = connman_dbus_get_connection();
if (connection == NULL)
return -EIO;