Change db path 47/85647/1 accepted/tizen/common/20160829.135929 accepted/tizen/common/20160830.150146 accepted/tizen/ivi/20160830.061216 accepted/tizen/mobile/20160830.060940 accepted/tizen/tv/20160830.061045 accepted/tizen/wearable/20160830.061130 submit/tizen/20160829.010716 submit/tizen/20160830.010724
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 26 Aug 2016 08:43:33 +0000 (17:43 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 26 Aug 2016 08:43:33 +0000 (17:43 +0900)
The rua db path is changed to "/run/aul/dbspace/<uid/".

- Requires
https://review.tizen.org/gerrit/#/c/85645/

Change-Id: Ic59df37dbd432a649489bd5013fffa5c38b50097
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/rua.c
src/rua_internal.c
src/rua_stat_internal.c
src/rua_util.c

index 42c28f7..a893d24 100644 (file)
--- a/src/rua.c
+++ b/src/rua.c
@@ -20,8 +20,6 @@
 #include <db-util.h>
 #include <aul.h>
 
-/* For multi-user support */
-#include <tzplatform_config.h>
 #include "rua_util.h"
 #include "rua_internal.h"
 #include "rua.h"
index 6438983..903c2ba 100644 (file)
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <tzplatform_config.h>
 #include <db-util.h>
 #include <aul.h>
 
index ee83905..38c3a06 100644 (file)
@@ -20,8 +20,6 @@
 #include <string.h>
 
 #include <db-util.h>
-/* For multi-user support */
-#include <tzplatform_config.h>
 
 #include "db-schema.h"
 #include "rua_stat_internal.h"
index d478039..39b2961 100644 (file)
@@ -22,7 +22,6 @@
 #include <grp.h>
 #include <pwd.h>
 
-#include <tzplatform_config.h>
 #include <sys/stat.h>
 #include <db-util.h>
 
 char *_rua_util_get_db_path(uid_t uid, char *db_name)
 {
        char db_path[PATH_MAX];
-       const char *db_path_prefix;
 
-       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);
+       snprintf(db_path, sizeof(db_path), "/run/aul/dbspace/%d/%s",
+                       uid, db_name);
        LOGD("db path %s", db_path);
 
        return strdup(db_path);
@@ -46,7 +41,9 @@ char *_rua_util_get_db_path(uid_t uid, char *db_name)
 int _rua_util_open_db(sqlite3 **db, int flags, uid_t uid, char *db_name)
 {
        int r;
-       char *db_path = _rua_util_get_db_path(uid, db_name);
+       char *db_path;
+
+       db_path = _rua_util_get_db_path(uid, db_name);
        if (db_path == NULL) {
                LOGE("out of memory _rua_util_get_db_path fail");
                return -1;
@@ -69,6 +66,7 @@ int _rua_util_open_db(sqlite3 **db, int flags, uid_t uid, char *db_name)
 int _rua_util_check_uid(uid_t target_uid)
 {
        uid_t uid = getuid();
+
        if (uid > BASE_UID && uid != target_uid) {
                LOGE("Invalid UID : %d, target UID : %d", uid, target_uid);
                return -1;