From: Tim Kientzle Date: Fri, 9 Jan 2009 06:49:07 +0000 (-0500) Subject: Fix Issue 3: http://code.google.com/p/libarchive/issues/detail?id=3 X-Git-Tag: v2.7.0~443 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=398d89f654892c63e8e1907a4e178c1eef3bf188;p=thirdparty%2Flibarchive.git Fix Issue 3: http://code.google.com/p/libarchive/issues/detail?id=3 This occurs with Zip archives that have entries that are compressed with deflate even though they are zero bytes long. Libarchive's zip handler returns a zero-byte block from the decompression before returning end-of-entry. Writing that zero-byte block back to the filesystem triggered some code intended to catch misuse of the API. The fix suppresses the warning in the case of a zero-byte write request. This is all very silly: compressing a zero-byte file is a silly thing to do, libarchive's zip format handler is returning a silly sequence of responses, and the warning is silly. Oh, well. At least I fixed the warning. ;-) SVN-Revision: 407 --- diff --git a/libarchive/archive_write_disk.c b/libarchive/archive_write_disk.c index 5aa50c191..c1ddf77e7 100644 --- a/libarchive/archive_write_disk.c +++ b/libarchive/archive_write_disk.c @@ -519,6 +519,9 @@ write_data_block(struct archive_write_disk *a, ssize_t bytes_written = 0; ssize_t block_size = 0, bytes_to_write; + if (size == 0) + return (ARCHIVE_OK); + if (a->filesize == 0 || a->fd < 0) { archive_set_error(&a->archive, 0, "Attempt to write to an empty file");