libstorage: Fixed wrong space value 16/44816/2 accepted/tizen/mobile/20150729.011140 accepted/tizen/tv/20150729.011305 accepted/tizen/wearable/20150729.011359 submit/tizen/20150728.111713
authorJiyoung Yun <jy910.yun@samsung.com>
Tue, 28 Jul 2015 07:03:59 +0000 (16:03 +0900)
committerJiyoung Yun <jy910.yun@samsung.com>
Tue, 28 Jul 2015 07:31:55 +0000 (00:31 -0700)
The size of unsigned long long is not the same with int's size.
But it has copied int value to unsigned long long value.
It makes wrong copy operation.

Change-Id: Ief253146585ffc7474f9bd623c4680c8d516ede5
Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
src/storage-sdcard.c

index fc02c6b..70be220 100755 (executable)
@@ -61,13 +61,11 @@ static int sdcard_get_space(unsigned long long *total, unsigned long long *avail
 {
        storage_state_e state;
        struct statvfs s;
-       int ret, t, a;
+       int ret;
+       unsigned long long t = 0, a = 0;
 
        state = sdcard_get_state();
-       if (state < STORAGE_STATE_MOUNTED) {
-               t = 0;
-               a = 0;
-       } else {        /* if sdcard is mounted */
+       if (state >= STORAGE_STATE_MOUNTED) {
 #ifndef __USE_FILE_OFFSET64
                ret = storage_get_external_memory_size(&s);
 #else