libstorage: Add memory size check routine 86/39886/1 accepted/tizen/common/20150526.081221 accepted/tizen/mobile/20150526.094906 accepted/tizen/tv/20150526.094350 accepted/tizen/wearable/20150526.094645 submit/tizen/20150526.043931
authorJiyoung Yun <jy910.yun@samsung.com>
Thu, 21 May 2015 08:03:05 +0000 (17:03 +0900)
committerJiyoung Yun <jy910.yun@samsung.com>
Tue, 26 May 2015 04:26:38 +0000 (13:26 +0900)
If a memory size is zero, it does not try to divide by zero.

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

index ca2c62b..81d323f 100644 (file)
@@ -250,7 +250,7 @@ API int storage_get_internal_memory_size(struct statvfs *buf)
        }
 
        ret = get_memory_size(MEMORY_STATUS_USR_PATH, &temp);
-       if (ret) {
+       if (ret || temp.f_bsize == 0) {
                _E("fail to get memory size");
                return -errno;
        }