summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2007-10-12 04:08:28 +0000
committerkientzle <kientzle@FreeBSD.org>2007-10-12 04:08:28 +0000
commit7f137794299c6358dee3eb8be2af419fcf98250d (patch)
treeeb261417a4541435fbd22cf3fd4a14c2edaee62b /lib
parent11057bb00f9f3b774ef74c31ebed91a17cb02a2b (diff)
downloadFreeBSD-src-7f137794299c6358dee3eb8be2af419fcf98250d.zip
FreeBSD-src-7f137794299c6358dee3eb8be2af419fcf98250d.tar.gz
Correct the return values of the final zero-length block at EOF.
Return EOF immediately if an entry in a ZIP archive has no body. In particular, the latter issue was causing bsdtar to emit spurious warnings when extracting directory entries from ZIP archives. MFC after: 3 days
Diffstat (limited to 'lib')
-rw-r--r--lib/libarchive/archive_read_support_format_zip.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libarchive/archive_read_support_format_zip.c b/lib/libarchive/archive_read_support_format_zip.c
index 80507bb..b07e14e 100644
--- a/lib/libarchive/archive_read_support_format_zip.c
+++ b/lib/libarchive/archive_read_support_format_zip.c
@@ -335,6 +335,10 @@ zip_read_file_header(struct archive_read *a, struct archive_entry *entry,
zip->entry_bytes_remaining = zip->compressed_size;
zip->entry_offset = 0;
+ /* If there's no body, force read_data() to return EOF immediately. */
+ if (zip->entry_bytes_remaining < 1)
+ zip->end_of_entry = 1;
+
/* Set up a more descriptive format name. */
sprintf(zip->format_name, "ZIP %d.%d (%s)",
zip->version / 10, zip->version % 10,
@@ -422,6 +426,9 @@ archive_read_format_zip_read_data(struct archive_read *a,
/* End-of-entry cleanup done. */
zip->end_of_entry_cleanup = 1;
}
+ *offset = zip->entry_uncompressed_bytes_read;
+ *size = 0;
+ *buff = NULL;
return (ARCHIVE_EOF);
}
OpenPOWER on IntegriCloud