mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-16 13:23:36 +00:00
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
This commit is contained in:
parent
58d14dae6d
commit
04a832627b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172559
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue