Fix wrong size calculation 17/106617/2 accepted/tizen/3.0/common/20161227.101307 accepted/tizen/3.0/ivi/20161226.024755 accepted/tizen/3.0/mobile/20161226.024704 accepted/tizen/3.0/tv/20161226.024729 accepted/tizen/3.0/wearable/20161226.024742 submit/tizen_3.0/20161222.014602
authorjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 22 Dec 2016 07:52:37 +0000 (16:52 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 22 Dec 2016 08:08:38 +0000 (17:08 +0900)
The size of shared/cache should be calculated as cache_size.

Change-Id: I227baa858b9ecf8e470edcc95d345ac07a981f22
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/pkg_getsize.c

index 64df2fe..8e4dfa4 100644 (file)
@@ -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;