Change rua-stat db path 94/91694/1
authorHyunho Kang <hhstark.kang@samsung.com>
Tue, 11 Oct 2016 01:44:27 +0000 (10:44 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Tue, 11 Oct 2016 01:47:37 +0000 (10:47 +0900)
rua stat should be remained after reboot

Change-Id: If1ab6aaa60185535b69f4491bba7ec86aca67783
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
src/rua_util.c

index 39b2961..067e299 100644 (file)
 
 #include <sys/stat.h>
 #include <db-util.h>
+#include <tzplatform_config.h>
 
 #include "rua_util.h"
+#include "rua_internal.h"
 
 char *_rua_util_get_db_path(uid_t uid, char *db_name)
 {
        char db_path[PATH_MAX];
+       const char *db_path_prefix;
 
-       snprintf(db_path, sizeof(db_path), "/run/aul/dbspace/%d/%s",
+       if (strcmp(db_name, RUA_DB_NAME) == 0) {
+               snprintf(db_path, sizeof(db_path), "/run/aul/dbspace/%d/%s",
                        uid, db_name);
+       } else {
+               tzplatform_set_user(uid);
+               db_path_prefix = tzplatform_getenv(TZ_USER_DB);
+               tzplatform_reset_user();
+               snprintf(db_path, sizeof(db_path), "%s/%s", db_path_prefix, db_name);
+       }
        LOGD("db path %s", db_path);
-
        return strdup(db_path);
 }