X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fpkgmgrinfo_db.c;h=b6134d044c76bf9a647002388d6b1ef88bb7ec9c;hb=26a48d898a57696e731bb8c3346ca7c6fc06d976;hp=7f8ecf8432a22502e47f701ddbd1a70db98e6c25;hpb=0086b6c3645de8fbfc64a9c943920d3a4ba5f3cb;p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git diff --git a/src/pkgmgrinfo_db.c b/src/pkgmgrinfo_db.c index 7f8ecf8..b6134d0 100644 --- a/src/pkgmgrinfo_db.c +++ b/src/pkgmgrinfo_db.c @@ -19,7 +19,6 @@ #include "pkgmgrinfo_debug.h" #include "pkgmgrinfo_private.h" #include "pkgmgr_parser.h" -#include "pkgmgr_parser_internal.h" #define QUERY_CREATE_TABLE_PACKAGE_CERT_INDEX_INFO \ "CREATE TABLE IF NOT EXISTS package_cert_index_info( " \ @@ -279,11 +278,10 @@ API const char *getIconPath(uid_t uid, bool readonly) if (readonly) path = tzplatform_mkpath(TZ_SYS_RO_ICONS, "/"); - else - path = tzplatform_mkpath(TZ_SYS_RW_ICONS, "/"); /* just allow certain users to create the icon directory if needed. */ - if (uid_caller == ROOT_UID || uid_caller == APPFW_UID || uid_caller == uid) + if (path && (uid_caller == ROOT_UID || + uid_caller == APPFW_UID || uid_caller == uid)) _mkdir_for_user(path, uid, gid); return path; @@ -315,7 +313,7 @@ API char *getUserPkgParserDBPathUID(uid_t uid) tzplatform_reset_user(); } - // just allow certain users to create the dbspace directory if needed. + /* 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); @@ -350,7 +348,7 @@ API char *getUserPkgCertDBPathUID(uid_t uid) tzplatform_reset_user(); } - // just allow certain users to create the dbspace directory if needed. + /* 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); @@ -538,7 +536,7 @@ void _save_column_str(sqlite3_stmt *stmt, int idx, char **str) *str = strdup(val); } -API int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char *pkgid, INSTALL_LOCATION location, uid_t uid) +API int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char *pkgid, INSTALL_LOCATION location, const char *external_pkg_path, uid_t uid) { retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL\n"); int ret = -1; @@ -569,8 +567,8 @@ API int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char *pkgid, INSTALL_ /* pkgcakge_info table */ query = sqlite3_mprintf( - "update package_info set installed_storage=%Q where package=%Q", - location ? "installed_external" : "installed_internal", pkgid); + "update package_info set installed_storage=%Q, external_path=%Q where package=%Q", + location ? "installed_external" : "installed_internal", external_pkg_path, pkgid); ret = sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, NULL); tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s\n", query); @@ -578,8 +576,8 @@ API int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char *pkgid, INSTALL_ /* package_app_info table */ query = sqlite3_mprintf( - "update package_app_info set app_installed_storage=%Q where package=%Q", - location ? "installed_external" : "installed_internal", pkgid); + "update package_app_info set app_installed_storage=%Q, app_external_path=%Q where package=%Q", + location ? "installed_external" : "installed_internal", external_pkg_path, pkgid); ret = sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, NULL); tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s\n", query); @@ -600,7 +598,7 @@ catch: return ret; } -API int pkgmgrinfo_pkginfo_set_installed_storage(const char *pkgid, INSTALL_LOCATION location) +API int pkgmgrinfo_pkginfo_set_installed_storage(const char *pkgid, INSTALL_LOCATION location, const char *external_pkg_path) { - return pkgmgrinfo_pkginfo_set_usr_installed_storage(pkgid, location, _getuid()); + return pkgmgrinfo_pkginfo_set_usr_installed_storage(pkgid, location, external_pkg_path, _getuid()); }