From 683c4628039a8cb6dad1a086fae23a7d71438414 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 5 May 2009 17:50:21 -0700 Subject: align data passed to write() on 32k boundaries In donut, OTA installation often encounters the write() system call doing short writes -- which is legal but unexpected -- or failing with ENOSPC when plenty of space is available. Passing aligned memory buffers to write() appears to prevent (or at least reduce the frequency) of these problems. b/1833052 has been filed to look at the underlying problem, but this change aligns buffers we use with write() so we can OTA for now (or see if this problem still occurs). --- minzip/Zip.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'minzip/Zip.h') diff --git a/minzip/Zip.h b/minzip/Zip.h index 1c1df2fae..57c0abd2c 100644 --- a/minzip/Zip.h +++ b/minzip/Zip.h @@ -55,6 +55,14 @@ typedef struct { size_t len; } UnterminatedString; +/* + * The information we pass down to writeProcessFunction. + */ +typedef struct { + int fd; + unsigned char* aligned_buffer; +} WriteInfo; + /* * Open a Zip archive. * @@ -166,7 +174,7 @@ bool mzIsZipEntryIntact(const ZipArchive *pArchive, const ZipEntry *pEntry); * Inflate and write an entry to a file. */ bool mzExtractZipEntryToFile(const ZipArchive *pArchive, - const ZipEntry *pEntry, int fd); + const ZipEntry *pEntry, WriteInfo *wi); /* * Inflate all entries under zipDir to the directory specified by -- cgit v1.2.3