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
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");