}
snprintf(pkgmgr_parser_db, sizeof(pkgmgr_parser_db),
"%s/.pkgmgr_parser.db", db_path);
-
- if (uid != GLOBAL_USER && uid != ROOT_UID) {
- tzplatform_set_user(uid);
- gid = _get_gid(tzplatform_getenv(TZ_SYS_USER_GROUP));
- tzplatform_reset_user();
+ if (access(db_path, F_OK) != 0) {
+ if (uid != GLOBAL_USER && uid != ROOT_UID) {
+ tzplatform_set_user(uid);
+ gid = _get_gid(tzplatform_getenv(TZ_SYS_USER_GROUP));
+ tzplatform_reset_user();
+ }
+ /* just allow certain users to create the dbspace directory if needed. */
+ if (uid_caller == ROOT_UID || uid_caller == APPFW_UID ||
+ uid_caller == uid)
+ _mkdir_for_user(db_path, uid, gid);
}
-
- /* just allow certain users to create the dbspace directory if needed. */
- if (uid_caller == ROOT_UID || uid_caller == APPFW_UID || uid_caller == uid)
- _mkdir_for_user(db_path, uid, gid);
-
free(db_path);
return strdup(pkgmgr_parser_db);
*i = sqlite3_column_int(stmt, idx);
}
-void _save_column_str(sqlite3_stmt *stmt, int idx, char **str)
+inline void _save_column_str(sqlite3_stmt *stmt, int idx, char **str)
{
const char *val;