From 3b4977638f48e59d23d7ea2bb6dde78552c257fb Mon Sep 17 00:00:00 2001 From: caozhiyuan Date: Tue, 19 May 2015 17:21:00 +0800 Subject: Use f_bavail to calculate free space Failures are seen on devices with Linux 3.10. And they are mainly due to this change: https://lwn.net/Articles/546473/ The blocks reserved in this change is not the same thing as what we think are reserved for common usage of root user. And this part is included in free blocks but not in available blocks. Change-Id: Ib29e12d775b86ef657c0af7fa7a944d2b1e12dc8 --- applypatch/applypatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'applypatch/applypatch.c') diff --git a/applypatch/applypatch.c b/applypatch/applypatch.c index 6f02a38ee..2358d4292 100644 --- a/applypatch/applypatch.c +++ b/applypatch/applypatch.c @@ -662,7 +662,7 @@ size_t FreeSpaceForFile(const char* filename) { printf("failed to statfs %s: %s\n", filename, strerror(errno)); return -1; } - return sf.f_bsize * sf.f_bfree; + return sf.f_bsize * sf.f_bavail; } int CacheSizeCheck(size_t bytes) { -- cgit v1.2.3