diff options
author | Doug Zongker <dougz@android.com> | 2010-08-13 09:41:21 -0700 |
---|---|---|
committer | Doug Zongker <dougz@android.com> | 2010-08-13 09:41:21 -0700 |
commit | 201cd46680f5789e21a57fb4476ab0ba0c0ed4c0 (patch) | |
tree | aba530f55ad47dd1dee46bdb06a1c766a23b8cdd /applypatch | |
parent | 8cd9e4f3d4eba481b411482331293c8079ab24b2 (diff) | |
download | bootable_recovery-201cd46680f5789e21a57fb4476ab0ba0c0ed4c0.zip bootable_recovery-201cd46680f5789e21a57fb4476ab0ba0c0ed4c0.tar.gz bootable_recovery-201cd46680f5789e21a57fb4476ab0ba0c0ed4c0.tar.bz2 |
remove shadowed variable declaration
An accidental variable declaration ("int enough_space = ..." instead
of "enough_space = " inside a block) shadowing the real one meant we
were always using the copy-to-cache path for patching, even when not
necessary. Remove it. Enforce an absolute minimum of free space as
well, to avoid running into problems patching small files, now that
the copy-to-cache path is (inadvertently) well-tested.
Change-Id: Idb7d57241a9adcda2e11001fa44f0cd67ce40d19
Diffstat (limited to 'applypatch')
-rw-r--r-- | applypatch/applypatch.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/applypatch/applypatch.c b/applypatch/applypatch.c index 5debaac..b85b915 100644 --- a/applypatch/applypatch.c +++ b/applypatch/applypatch.c @@ -645,7 +645,8 @@ int applypatch(const char* source_filename, int enough_space = 0; if (retry > 0) { size_t free_space = FreeSpaceForFile(target_fs); - int enough_space = + enough_space = + (free_space > (256 << 10)) && // 256k (two-block) minimum (free_space > (target_size * 3 / 2)); // 50% margin of error printf("target %ld bytes; free space %ld bytes; retry %d; enough %d\n", (long)target_size, (long)free_space, retry, enough_space); |