summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_read.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2007-12-30 04:58:22 +0000
committerkientzle <kientzle@FreeBSD.org>2007-12-30 04:58:22 +0000
commit2b8395148ff378e52a5e00c0d2ac0123258b759b (patch)
tree743c28601a2502c30676ab2adfbbb665fa3f38b7 /lib/libarchive/archive_read.c
parentb1a3a611be764b44dbdd47a17ec5076bcfbe6e88 (diff)
downloadFreeBSD-src-2b8395148ff378e52a5e00c0d2ac0123258b759b.zip
FreeBSD-src-2b8395148ff378e52a5e00c0d2ac0123258b759b.tar.gz
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.
Diffstat (limited to 'lib/libarchive/archive_read.c')
-rw-r--r--lib/libarchive/archive_read.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/libarchive/archive_read.c b/lib/libarchive/archive_read.c
index e0763f2..8ef839a 100644
--- a/lib/libarchive/archive_read.c
+++ b/lib/libarchive/archive_read.c
@@ -307,6 +307,18 @@ archive_read_next_header(struct archive *_a, struct archive_entry **entryp)
archive_clear_error(&a->archive);
/*
+ * If no format has yet been chosen, choose one.
+ */
+ if (a->format == NULL) {
+ slot = choose_format(a);
+ if (slot < 0) {
+ a->archive.state = ARCHIVE_STATE_FATAL;
+ return (ARCHIVE_FATAL);
+ }
+ a->format = &(a->formats[slot]);
+ }
+
+ /*
* If client didn't consume entire data, skip any remainder
* (This is especially important for GNU incremental directories.)
*/
@@ -324,12 +336,6 @@ archive_read_next_header(struct archive *_a, struct archive_entry **entryp)
/* Record start-of-header. */
a->header_position = a->archive.file_position;
- slot = choose_format(a);
- if (slot < 0) {
- a->archive.state = ARCHIVE_STATE_FATAL;
- return (ARCHIVE_FATAL);
- }
- a->format = &(a->formats[slot]);
ret = (a->format->read_header)(a, entry);
/*
OpenPOWER on IntegriCloud