From: jongmyeongko Date: Fri, 3 Jun 2016 04:14:05 +0000 (+0900) Subject: apply encoded_id to move behavior X-Git-Tag: accepted/tizen/ivi/20160606.040553 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2Faccepted%2Ftizen%2Fivi%2F20160606.040553;p=platform%2Fcore%2Fappfw%2Fapp2sd.git apply encoded_id to move behavior Change-Id: I64bbed6e5f0196dbe5e583374165ee9a4d829ecb Signed-off-by: jongmyeongko --- diff --git a/plugin/app2sd/src/app2sd_internals.c b/plugin/app2sd/src/app2sd_internals.c index 8f990db..1816e58 100644 --- a/plugin/app2sd/src/app2sd_internals.c +++ b/plugin/app2sd/src/app2sd_internals.c @@ -746,6 +746,7 @@ int _app2sd_move_app_to_external(const char *pkgid, GList* dir_list, uid_t uid) GList *list = NULL; app2ext_dir_details* dir_detail = NULL; char err_buf[1024] = {0,}; + char *encoded_id = NULL; /* check whether MMC is present or not */ ret = _app2sd_check_mmc_status(); @@ -754,21 +755,22 @@ int _app2sd_move_app_to_external(const char *pkgid, GList* dir_list, uid_t uid) return APP2EXT_ERROR_MMC_STATUS; } + encoded_id = _app2sd_get_encoded_name(pkgid, uid); + if (encoded_id == NULL) { + return APP2EXT_ERROR_MEMORY_ALLOC_FAILED; + } + snprintf(loopback_device, FILENAME_MAX - 1, "%s/%s", + APP2SD_PATH, encoded_id); + free(encoded_id); if (_is_global(uid)) { snprintf(application_path, FILENAME_MAX - 1, "%s/%s", tzplatform_getenv(TZ_SYS_RW_APP), pkgid); - snprintf(loopback_device, FILENAME_MAX - 1, "%s/%s", - APP2SD_PATH, pkgid); } else { tzplatform_set_user(uid); snprintf(application_path, FILENAME_MAX - 1, "%s/%s", tzplatform_getenv(TZ_USER_APP), pkgid); - snprintf(loopback_device, FILENAME_MAX - 1, "%s/%s/%s", - APP2SD_PATH, tzplatform_getenv(TZ_USER_NAME), pkgid); tzplatform_reset_user(); } - _D("application_path = (%s)", application_path); - _D("loopback_device = (%s)", loopback_device); /* check whether application is in external memory or not */ fp = fopen(loopback_device, "r+"); @@ -988,6 +990,7 @@ int _app2sd_move_app_to_internal(const char *pkgid, GList* dir_list, uid_t uid) struct statvfs buf = {0,}; unsigned long long temp = 0; char err_buf[1024] = {0,}; + char *encoded_id = NULL; /* check whether MMC is present or not */ ret = _app2sd_check_mmc_status(); @@ -996,21 +999,22 @@ int _app2sd_move_app_to_internal(const char *pkgid, GList* dir_list, uid_t uid) return APP2EXT_ERROR_MMC_STATUS; } + encoded_id = _app2sd_get_encoded_name(pkgid, uid); + if (encoded_id == NULL) { + return APP2EXT_ERROR_MEMORY_ALLOC_FAILED; + } + snprintf(loopback_device, FILENAME_MAX - 1, "%s/%s", + APP2SD_PATH, encoded_id); + free(encoded_id); if (_is_global(uid)) { snprintf(application_path, FILENAME_MAX - 1, "%s/%s", tzplatform_getenv(TZ_SYS_RW_APP), pkgid); - snprintf(loopback_device, FILENAME_MAX - 1, "%s/%s", - APP2SD_PATH, pkgid); } else { tzplatform_set_user(uid); snprintf(application_path, FILENAME_MAX - 1, "%s/%s", tzplatform_getenv(TZ_USER_APP), pkgid); - snprintf(loopback_device, FILENAME_MAX - 1, "%s/%s/%s", - APP2SD_PATH, tzplatform_getenv(TZ_USER_NAME), pkgid); tzplatform_reset_user(); } - _D("application_path = (%s)", application_path); - _D("loopback_device = (%s)", loopback_device); /* check whether application is in external memory or not */ fp = fopen(loopback_device, "r+");