summaryrefslogtreecommitdiffstats
path: root/lib/libarchive
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-12-22 00:49:16 +0000
committerkientzle <kientzle@FreeBSD.org>2004-12-22 00:49:16 +0000
commit66ddfc8a7863b6b83b01f1a61dd6e6d285048bce (patch)
treed6b620be20deb0804bead04c1024dcdd693bb454 /lib/libarchive
parent38e8a38c1291c29aef398b340693e23eb85b726b (diff)
downloadFreeBSD-src-66ddfc8a7863b6b83b01f1a61dd6e6d285048bce.zip
FreeBSD-src-66ddfc8a7863b6b83b01f1a61dd6e6d285048bce.tar.gz
Tune the bidding for tar archives. This
improves the recognition of hardlink entries with/without bodies (which is implemented through a look-ahead that uses the bid function). MFC after: 7 days
Diffstat (limited to 'lib/libarchive')
-rw-r--r--lib/libarchive/archive_read_support_format_tar.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libarchive/archive_read_support_format_tar.c b/lib/libarchive/archive_read_support_format_tar.c
index f273998..3a197c2 100644
--- a/lib/libarchive/archive_read_support_format_tar.c
+++ b/lib/libarchive/archive_read_support_format_tar.c
@@ -295,8 +295,14 @@ archive_read_format_tar_bid(struct archive *a)
}
/* If it's an end-of-archive mark, we can handle it. */
- if ((*(const char *)h) == 0 && archive_block_is_null(h))
- return (bid + 1);
+ if ((*(const char *)h) == 0 && archive_block_is_null(h)) {
+ /* If it's a known tar file, end-of-archive is definite. */
+ if ((a->archive_format & ARCHIVE_FORMAT_BASE_MASK) ==
+ ARCHIVE_FORMAT_TAR)
+ return (512);
+ /* Empty archive? */
+ return (1);
+ }
/* If it's not an end-of-archive mark, it must have a valid checksum.*/
if (!checksum(a, h))
@@ -321,6 +327,7 @@ archive_read_format_tar_bid(struct archive *a)
!( header->typeflag[0] >= 'A' && header->typeflag[0] <= 'Z') &&
!( header->typeflag[0] >= 'a' && header->typeflag[0] <= 'z') )
return (0);
+ bid += 2; /* 6 bits of variation in an 8-bit field leaves 2 bits. */
/* Sanity check: Look at first byte of mode field. */
switch (255 & (unsigned)header->mode[0]) {
OpenPOWER on IntegriCloud