From 13f58c2d518d5cbd1d390457fa75c43908a4b9d3 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 16 Apr 2019 09:55:20 +0900 Subject: [PATCH] Fix wrong db path Change-Id: I768cd081dddaf5045652612fbe9d2ff59a7477ac Signed-off-by: Hwankyu Jhun --- parser/component/src/component_plugin_parser_db.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/parser/component/src/component_plugin_parser_db.c b/parser/component/src/component_plugin_parser_db.c index 8eb24da..1608b80 100644 --- a/parser/component/src/component_plugin_parser_db.c +++ b/parser/component/src/component_plugin_parser_db.c @@ -107,16 +107,23 @@ static bool __is_global_user(uid_t uid) static const char *__get_db_path(uid_t uid) { + static char db_path[PATH_MAX]; const char *path; - if (!__is_global_user(uid)) - tzplatform_set_user(uid); + path = tzplatform_getenv(TZ_SYS_DB); + if (!path) { + LOGE("Failed to get TZ_SYS_DB path"); + return NULL; + } - path = tzplatform_mkpath(__is_global_user(uid) ? - TZ_SYS_DB : TZ_USER_DB, ".component.db"); - tzplatform_reset_user(); + if (__is_global_user(uid)) { + snprintf(db_path, sizeof(db_path), "%s/.component.db", path); + } else { + snprintf(db_path, sizeof(db_path), "%s/user/%u/.component.db", + path, uid); + } - return path; + return db_path; } static int __db_busy_handler(void *data, int count) -- 2.7.4