From f5d9f891524862ba560650bd545668dc22622cdb Mon Sep 17 00:00:00 2001 From: Michael Runge Date: Tue, 6 May 2014 16:54:42 -0700 Subject: Allow 0-byte files in full OTAs. Currently, the writeProcessFunction fails when there are zero bytes to write, potentially returning errno from a previous operation, or hanging indefinitely while it waits for a >0 result on a write of size 0. This happens when the output file is intended to be zero bytes in size. Change-Id: Ib3cfcaf66d82942bc89e5f5c64697862403b38da --- minzip/Zip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/minzip/Zip.c b/minzip/Zip.c index abc9890..5070104 100644 --- a/minzip/Zip.c +++ b/minzip/Zip.c @@ -698,7 +698,9 @@ static bool writeProcessFunction(const unsigned char *data, int dataLen, void *cookie) { int fd = (int)(intptr_t)cookie; - + if (dataLen == 0) { + return true; + } ssize_t soFar = 0; while (true) { ssize_t n = write(fd, data+soFar, dataLen-soFar); -- cgit v1.1