diff options
author | caozhiyuan <cao.zhiyuan@zte.com.cn> | 2015-05-19 17:21:00 +0800 |
---|---|---|
committer | Tao Bao <tbao@google.com> | 2015-06-26 11:17:02 -0700 |
commit | cb9450e11337700907a7a5ec290902196c74fa9b (patch) | |
tree | 52a68ca0172b97d75a6fbf248ffac01e83402330 | |
parent | c35f3ce30e4bb0de33fe6fcf0b928d0e4b7269b0 (diff) | |
download | bootable_recovery-cb9450e11337700907a7a5ec290902196c74fa9b.zip bootable_recovery-cb9450e11337700907a7a5ec290902196c74fa9b.tar.gz bootable_recovery-cb9450e11337700907a7a5ec290902196c74fa9b.tar.bz2 |
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.
Bug: 22118089
Change-Id: I81c9531703298019a4fc11839f28d2cc8b9df34e
(cherry picked from commit 3b4977638f48e59d23d7ea2bb6dde78552c257fb)
-rw-r--r-- | applypatch/applypatch.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/applypatch/applypatch.c b/applypatch/applypatch.c index 6f02a38..2358d42 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) { |