Merge "Remove unwanted NULL check for service in append_properties()" into tizen
[platform/upstream/connman.git] / src / storage.c
index 7d03130..6ca600b 100755 (executable)
@@ -27,6 +27,7 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <dirent.h>
+#include <stdio.h>
 
 #include <connman/storage.h>
 
@@ -43,8 +44,6 @@ static GKeyFile *storage_load(const char *pathname)
        GKeyFile *keyfile = NULL;
        GError *error = NULL;
 
-       DBG("Loading %s", pathname);
-
        keyfile = g_key_file_new();
 
        if (!g_key_file_load_from_file(keyfile, pathname, 0, &error)) {
@@ -73,6 +72,19 @@ static int storage_save(GKeyFile *keyfile, char *pathname)
                ret = -EIO;
        }
 
+#if defined TIZEN_EXT
+       {
+               FILE *fp = NULL;
+               fp = fopen(pathname, "a+");
+               if(fp){
+                       fflush(fp);
+                       fsync(fp->_fileno);
+                       fclose(fp);
+                       DBG("sync the file to disk");
+               }
+       }
+#endif
+
        g_free(data);
 
        return ret;