Remove hardcoded path for multiuser support
[platform/core/appfw/vconf.git] / vconf.c
diff --git a/vconf.c b/vconf.c
index a6af153..382861f 100755 (executable)
--- a/vconf.c
+++ b/vconf.c
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <sys/xattr.h>
 #include <ctype.h>
+#include <tzplatform_config.h>
 
 #ifndef API
 #define API __attribute__ ((visibility("default")))
 #ifdef VCONF_USE_SQLFS_TRANSACTION
 int IN_SBOX=0;
 
-#define VCONF_MOUNT_PATH "/opt/var/kdb/db"
+#define VCONF_MOUNT_PATH tzplatform_mkpath(TZ_SYS_CONFIG,"db")
 #define VCONF_MOUNT_PATH_CHECK \
 do{\
        if(!IN_SBOX) \
-      IN_SBOX = access("/opt/var/kdb/kdb_first_boot", F_OK) + 2; \
+      IN_SBOX = access(tzplatform_mkpath(TZ_SYS_CONFIG,"kdb_first_boot"), F_OK) + 2; \
        if(2==IN_SBOX) return 0;\
 }while(0)
 
@@ -156,6 +157,7 @@ static keynode_t *_vconf_keylist_lookup(keylist_t *keylist, const char *keyname,
                                 keynode_t **before_keynode)
 {
        keynode_t *found_node, *temp_node = NULL;
+       size_t length = 1 + strlen(keyname);
 
        found_node = _vconf_keylist_headnode(keylist);
 
@@ -165,7 +167,7 @@ static keynode_t *_vconf_keylist_lookup(keylist_t *keylist, const char *keyname,
                        return NULL;
                }
 
-               if (!strncmp(keyname, found_node->keyname, strlen(keyname))) {
+               if (!memcmp(keyname, found_node->keyname, length)) {
                        if (before_keynode) {
                                        *before_keynode = temp_node;
                        }