From 9dd49f960f9b30644843e2f2b41bc1579d0aeba3 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sun, 30 Dec 2007 04:58:22 +0000 Subject: Update libarchive to 2.4.10. This includes a number of improvements that I've been working on but put off committing until after the RELENG_7 branch, including: * New manpages: cpio.5 mtree.5 * New archive_entry_strmode() * New archive_entry_link_resolver() * New read support: mtree format * Internal API change: read format auction only runs once * Running the auction only once allowed simplifying a lot of bid logic. * Cpio robustness: search for next header after a sync error * Support device nodes on ISO9660 images * Eliminate a lot of unnecessary copies for uncompressed archives * Corrected handling of new GNU --sparse --posix formats * Correctly handle a zero-byte write to a compressed archive * Fixed memory leaks Many of these improvements were motivated by the upcoming bsdcpio front-end. There have also been extensive improvements to the libarchive_test test harness, which I'll commit separately. --- lib/libarchive/archive_read_support_format_zip.c | 25 ++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'lib/libarchive/archive_read_support_format_zip.c') diff --git a/lib/libarchive/archive_read_support_format_zip.c b/lib/libarchive/archive_read_support_format_zip.c index e9976779f407..52392cc75ef6 100644 --- a/lib/libarchive/archive_read_support_format_zip.c +++ b/lib/libarchive/archive_read_support_format_zip.c @@ -179,18 +179,19 @@ archive_read_format_zip_bid(struct archive_read *a) return (-1); p = (const char *)h; + /* + * Bid of 30 here is: 16 bits for "PK", + * next 16-bit field has four options (-2 bits). + * 16 + 16-2 = 30. + */ if (p[0] == 'P' && p[1] == 'K') { - bid += 16; - if (p[2] == '\001' && p[3] == '\002') - bid += 16; - else if (p[2] == '\003' && p[3] == '\004') - bid += 16; - else if (p[2] == '\005' && p[3] == '\006') - bid += 16; - else if (p[2] == '\007' && p[3] == '\010') - bid += 16; + if ((p[2] == '\001' && p[3] == '\002') + || (p[2] == '\003' && p[3] == '\004') + || (p[2] == '\005' && p[3] == '\006') + || (p[2] == '\007' && p[3] == '\010')) + return (30); } - return (bid); + return (0); } static int @@ -765,8 +766,8 @@ process_extra(const void* extra, struct zip* zip) if (flags & 0x01) { #ifdef DEBUG - fprintf(stderr, "mtime: %d -> %d\n", - zip->mtime, i4(p + offset)); + fprintf(stderr, "mtime: %lld -> %d\n", + (long long)zip->mtime, i4(p + offset)); #endif if (datasize < 4) break; -- cgit v1.3