Fixed the build error using gcc 13
[platform/core/system/libstorage.git] / src / statvfs.c
index 7883276..6e9f841 100644 (file)
@@ -80,22 +80,22 @@ static int load_config(struct parse_result *result, void *user_data)
 
 static void storage_config_load(struct storage_config_info *info)
 {
-       int ret;
+       int ret_val;
 
-       ret = config_parse(STORAGE_CONF_FILE, load_config, info);
-       if (ret < 0)
-               _E("Failed to load %s, %d Use default value!", STORAGE_CONF_FILE, ret); //LCOV_EXCL_LINE
+       ret_val = config_parse(STORAGE_CONF_FILE, load_config, info);
+       if (ret_val < 0)
+               _E("Failed to load %s, %d Use default value!", STORAGE_CONF_FILE, ret_val); //LCOV_EXCL_LINE
 }
 
 static int get_memory_size(const char *path, struct statvfs_32 *buf)
 {
        struct statvfs s;
-       int ret;
+       int ret_val;
 
        assert(buf);
 
-       ret = statvfs(path, &s);
-       if (ret)
+       ret_val = statvfs(path, &s);
+       if (ret_val)
                return -errno; //LCOV_EXCL_LINE System Error
 
        memset(buf, 0, sizeof(struct statvfs_32));
@@ -118,18 +118,18 @@ static int get_memory_size(const char *path, struct statvfs_32 *buf)
 /* This api is intended for binaries built with _FILE_OFFSET_BITS=32 */
 API int storage_get_internal_memory_size(struct statvfs *buf)
 {
-       struct statvfs_32 temp;
+       struct statvfs_32 temp = { 0, };
        static unsigned long reserved = 0;
-       int ret;
+       int ret_val;
 
        if (!buf) {
                _E("input param error");
                return STORAGE_ERROR_INVALID_PARAMETER;
        }
 
-       ret = get_memory_size(tzplatform_getenv(TZ_SYS_USER), &temp);
-       if (ret || temp.f_bsize == 0) {
-               _E("fail to get memory size %d", ret); //LCOV_EXCL_LINE
+       ret_val = get_memory_size(tzplatform_getenv(TZ_SYS_USER), &temp);
+       if (ret_val || temp.f_bsize == 0) {
+               _E("fail to get memory size %d", ret_val); //LCOV_EXCL_LINE
                return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
@@ -154,15 +154,15 @@ API int storage_get_internal_memory_size(struct statvfs *buf)
 API int storage_get_internal_memory_size64(struct statvfs *buf)
 {
        static unsigned long reserved = 0;
-       int ret;
+       int ret_val;
 
        if (!buf) {
                _E("input param error"); //LCOV_EXCL_LINE
                return STORAGE_ERROR_INVALID_PARAMETER;
        }
 
-       ret = statvfs(tzplatform_getenv(TZ_SYS_USER), buf);
-       if (ret) {
+       ret_val = statvfs(tzplatform_getenv(TZ_SYS_USER), buf);
+       if (ret_val) {
                _E("fail to get memory size"); //LCOV_EXCL_LINE
                return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
@@ -211,7 +211,7 @@ static int get_external_path(char *path, size_t len)
 int storage_get_external_memory_size_with_path(char *path, struct statvfs *buf)
 {
        struct statvfs_32 temp;
-       int ret;
+       int ret_val;
        char ext_path[32];
 
        _D("storage_get_external_memory_size");
@@ -227,11 +227,11 @@ int storage_get_external_memory_size_with_path(char *path, struct statvfs *buf)
                        _D("Block module is not enabled");
                        return STORAGE_ERROR_NOT_SUPPORTED;
                }
-               ret = get_external_path(ext_path, sizeof(ext_path));
-               if (ret == -ENODEV)
+               ret_val = get_external_path(ext_path, sizeof(ext_path));
+               if (ret_val == -ENODEV)
                        goto out_nodev;
-               if (ret < 0) {
-                       _E("Failed to get external path(%d)", ret); //LCOV_EXCL_LINE
+               if (ret_val < 0) {
+                       _E("Failed to get external path(%d)", ret_val); //LCOV_EXCL_LINE
                        return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
                }
        }
@@ -239,8 +239,8 @@ int storage_get_external_memory_size_with_path(char *path, struct statvfs *buf)
        if (!mount_check((const char *)ext_path))
                goto out_nodev;
 
-       ret = storage_ext_get_statvfs(ext_path, &temp);
-       if (ret != 0) {
+       ret_val = storage_ext_get_statvfs(ext_path, &temp);
+       if (ret_val != 0) {
                _E("fail to get memory size"); //LCOV_EXCL_LINE
                return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
@@ -256,7 +256,7 @@ out_nodev:
 /* This api is intended for binaries built with __USE_FILE_OFFSET64(_FILE_OFFSET_BITS=64) */
 int storage_get_external_memory_size64_with_path(char *path, struct statvfs *buf)
 {
-       int ret;
+       int ret_val;
        char ext_path[32];
 
        _D("storage_get_external_memory_size64");
@@ -272,11 +272,11 @@ int storage_get_external_memory_size64_with_path(char *path, struct statvfs *buf
                        _D("Block module is not enabled");
                        return STORAGE_ERROR_NOT_SUPPORTED;
                }
-               ret = get_external_path(ext_path, sizeof(ext_path));
-               if (ret == -ENODEV)
+               ret_val = get_external_path(ext_path, sizeof(ext_path));
+               if (ret_val == -ENODEV)
                        goto out_nodev;
-               if (ret < 0) {
-                       _E("Failed to get external path(%d)", ret);
+               if (ret_val < 0) {
+                       _E("Failed to get external path(%d)", ret_val);
                        return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
                }
        }
@@ -284,8 +284,8 @@ int storage_get_external_memory_size64_with_path(char *path, struct statvfs *buf
        if (!mount_check((const char *)ext_path))
                goto out_nodev;
 
-       ret = storage_ext_get_statvfs_size64(ext_path, buf);
-       if (ret != 0) {
+       ret_val = storage_ext_get_statvfs_size64(ext_path, buf);
+       if (ret_val != 0) {
        //LCOV_EXCL_START System Error
                _E("fail to get memory size");
                return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE