Fix casting bug, add control for hard quotas.
(cherry picked from commit bdd4de8a98d57110befb0c29f662e8a3e4cfc275)
Bug: 64160395, 63255278
Test: /data/nativetest/installd_service_test/installd_cache_test
Merged-In: I8e2e24afd88da4dc13afdf05927e59c268e69825
Change-Id: I8e2e24afd88da4dc13afdf05927e59c268e69825
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp
index 7fa356f..462d004 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -656,7 +656,7 @@
int64_t data_disk_free(const std::string& data_path) {
struct statvfs sfs;
if (statvfs(data_path.c_str(), &sfs) == 0) {
- return sfs.f_bavail * sfs.f_frsize;
+ return static_cast<int64_t>(sfs.f_bavail) * sfs.f_frsize;
} else {
PLOG(ERROR) << "Couldn't statvfs " << data_path;
return -1;