diff options
author | Hyunho Kang <hhstark.kang@samsung.com> | 2016-06-29 19:37:21 +0900 |
---|---|---|
committer | Hyunho Kang <hhstark.kang@samsung.com> | 2016-06-29 19:38:57 +0900 |
commit | 8825605008c3befb31c725a2b730f8e43ab5a061 (patch) | |
tree | 1a4906a1a6efb814615af4fa6601b1ae85ee2064 /src | |
parent | bb4305148dba90ff1f0b7ea6e1542efa822a295f (diff) | |
download | librua-8825605008c3befb31c725a2b730f8e43ab5a061.tar.gz librua-8825605008c3befb31c725a2b730f8e43ab5a061.tar.bz2 librua-8825605008c3befb31c725a2b730f8e43ab5a061.zip |
Fix wrong rua_stat_init parametersubmit/tizen/20160629.112854accepted/tizen/wearable/20160630.004015accepted/tizen/tv/20160630.003945accepted/tizen/mobile/20160630.004020accepted/tizen/ivi/20160630.004002accepted/tizen/common/20160629.223410
Change-Id: Ic08d5269ad978ec5b44e59bbcf4c401a93861d20
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/rua_stat_internal.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/rua_stat_internal.c b/src/rua_stat_internal.c index 254e7d3..5fd59e6 100644 --- a/src/rua_stat_internal.c +++ b/src/rua_stat_internal.c @@ -171,37 +171,30 @@ static int __create_table(sqlite3 *db) return 0; } -static sqlite3 *__db_init(sqlite3 *db, char *root, int flags) +int _rua_stat_init(sqlite3 **db, int flags) { + char defname[FILENAME_MAX]; + const char *rua_stat_db_path = tzplatform_getenv(TZ_USER_DB); int r; - r = db_util_open_with_options(root, &db, flags, NULL); + snprintf(defname, sizeof(defname), "%s/%s", rua_stat_db_path, RUA_STAT_DB_NAME); + r = db_util_open_with_options(defname, db, flags, NULL); if (r) { LOGE("db util open error(%d/%d/%d/%s)", r, - sqlite3_errcode(db), - sqlite3_extended_errcode(db), - sqlite3_errmsg(db)); + sqlite3_errcode(*db), + sqlite3_extended_errcode(*db), + sqlite3_errmsg(*db)); return NULL; } - r = __create_table(db); + + r = __create_table(*db); if (r) { - db_util_close(db); + db_util_close(*db); return NULL; } - return db; -} - -int _rua_stat_init(sqlite3 *db, int flags) -{ - char defname[FILENAME_MAX]; - const char *rua_stat_db_path = tzplatform_getenv(TZ_USER_DB); - - snprintf(defname, sizeof(defname), "%s/%s", rua_stat_db_path, RUA_STAT_DB_NAME); - __db_init(db, defname, flags); - - if (db == NULL) { + if (*db == NULL) { LOGW("__rua_stat_init error"); return -1; } @@ -226,7 +219,7 @@ int rua_stat_db_update(char *caller, char *rua_stat_tag) LOGD("rua_stat_update start"); - r = _rua_stat_init(db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE); + r = _rua_stat_init(&db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE); if (r == -1) { LOGE("__rua_stat_init fail"); return -1; |