From 4b832e0b355b5cd79233bf2495795e98bdc08b8c Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Thu, 22 Dec 2016 16:52:37 +0900 Subject: [PATCH] Fix wrong size calculation The size of shared/cache should be calculated as cache_size. Change-Id: I227baa858b9ecf8e470edcc95d345ac07a981f22 Signed-off-by: jongmyeongko --- src/pkg_getsize.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pkg_getsize.c b/src/pkg_getsize.c index 64df2fe..8e4dfa4 100644 --- a/src/pkg_getsize.c +++ b/src/pkg_getsize.c @@ -146,7 +146,8 @@ error: } static long long __calculate_shared_dir_size(int dfd, const char *app_root_dir, - long long *data_size, long long *app_size) + long long *data_size, long long *app_size, + long long *cache_size) { int fd = -1; int subfd = -1; @@ -236,8 +237,8 @@ static long long __calculate_shared_dir_size(int dfd, const char *app_root_dir, LOGE("Calculating shared/cache directory failed."); goto error; } - *data_size += size; - LOGD("data_size: %lld", *data_size); + *cache_size += size; + LOGD("cache_size: %lld", *cache_size); close(subfd); } else if (subfd < 0 && errno != ENOENT) { LOGE("openat() failed, file_info: data, errno: %d (%s)", @@ -354,7 +355,7 @@ static int __calculate_pkg_size_info(STORAGE_TYPE type, const char *pkgid, LOGD("cache_size: %lld", *cache_size); } else if (strncmp(name, "shared", strlen("shared")) == 0) { size = __calculate_shared_dir_size(dfd, app_root_dir, - data_size, app_size); + data_size, app_size, cache_size); if (size < 0) { LOGE("Calculating shared directory failed."); goto error; -- 2.7.4