summaryrefslogtreecommitdiffstats
path: root/libziparchive
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-10-27 14:21:12 -0700
committerElliott Hughes <enh@google.com>2017-10-27 14:21:12 -0700
commit4089d34b93908be28d594c22b7e6b027e3520d90 (patch)
treee276832e9acab0c1979be9b4340080002c8da700 /libziparchive
parent1ab86ad3bc3fd4b9c4e18e549d135e25ab07936a (diff)
downloadcore-4089d34b93908be28d594c22b7e6b027e3520d90.tar.gz
core-4089d34b93908be28d594c22b7e6b027e3520d90.tar.bz2
core-4089d34b93908be28d594c22b7e6b027e3520d90.zip
fastboot should fail if it runs out of space while unzipping.
Previously fastboot would carry on regardless if decompression failed: fastboot: archive does not contain 'vbmeta.img' fastboot: extracting vendor.img (260 MB)... fastboot: W/ziparchive(56777): Zip: unable to allocate 272781472 bytes at offset 0 : No space left on device fastboot: failed to extract 'vendor.img': I/O error fastboot: archive does not contain 'vendor_other.img' fastboot: wiping userdata... This is because all but "boot" and "system" are considered "optional", and the implementation of "optional" was "ignore any failures". What it _should_ have meant was "it's okay if these don't exist, but if they do, failures matter". Fix this logic, use die() more aggressively, and remove spurious "\n"s from die() format strings. Also fix spurious whitespace in the libziparchive format string. Before: Zip: unable to allocate 272781472 bytes at offset 0 : No space left on device After: Zip: unable to allocate 272781472 bytes at offset 0: No space left on device Bug: http://b/68383022 Test: `fastboot update` on marlin Change-Id: I3cbf55f1a33ca125f293f873eafbcfb86c880ba8
Diffstat (limited to 'libziparchive')
-rw-r--r--libziparchive/zip_archive.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index ad40d42ac..7f47adb5a 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -795,7 +795,7 @@ class FileWriter : public Writer {
// disk does not have enough space.
result = TEMP_FAILURE_RETRY(fallocate(fd, 0, current_offset, declared_length));
if (result == -1 && errno == ENOSPC) {
- ALOGW("Zip: unable to allocate %" PRId64 " bytes at offset %" PRId64 " : %s",
+ ALOGW("Zip: unable to allocate %" PRId64 " bytes at offset %" PRId64 ": %s",
static_cast<int64_t>(declared_length), static_cast<int64_t>(current_offset),
strerror(errno));
return std::unique_ptr<FileWriter>(nullptr);