Add support for state directory
[connman] / src / main.c
index 89c49fd..245dece 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <string.h>
 #include <signal.h>
+#include <sys/stat.h>
 
 #include <gdbus.h>
 
@@ -44,6 +46,9 @@ int main(int argc, char *argv[])
        DBusConnection *conn;
        struct sigaction sa;
 
+       mkdir(STATEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
+                       S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+
        main_loop = g_main_loop_new(NULL, FALSE);
 
        conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, CONNMAN_SERVICE);
@@ -75,5 +80,7 @@ int main(int argc, char *argv[])
 
        g_main_loop_unref(main_loop);
 
+       rmdir(STATEDIR);
+
        return 0;
 }