summaryrefslogtreecommitdiff
path: root/libarchive/archive_read_support_format_ar.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@gmail.com>2010-02-20 00:53:11 -0500
committerTim Kientzle <kientzle@gmail.com>2010-02-20 00:53:11 -0500
commit911dc2bff3dc37fa499c17379dcf35f352f88c0b (patch)
treebe38d9958879cea30c63edc440c6e31e826c6625 /libarchive/archive_read_support_format_ar.c
parent8f43f6931172a59c0e25647b35503a99d6f26fde (diff)
downloadlibarchive-911dc2bff3dc37fa499c17379dcf35f352f88c0b.tar.gz
Stackable write filter support. This ended up touching an awful lot
of files. But, the old API is supported almost entirely unchanged, which I wasn't certain would be possible. Big changes: * You can add more than one write filter by using archive_write_add_filter_{bzip2,compress,gzip,lzma,xz}. This will be more interesting when we have uuencode, RPM, encryption. * The old archive_write_set_compression_XXXX are shorthands for "remove all the current filters and add this one." They're deprecated and scheduled to be removed in libarchive 4.0. * The internal API and life cycle for write filters has been rationalized: create, set options, open, write, close, free. * New utility functions provide information about each filter when there's more than one: code, name, and number of bytes processed * Old archive_bytes_compressed(), etc, are implemented in terms of the more generic new functions. * The read side was generalized to also support the new utility functions. In particular, the write filters are much simpler since each one doesn't have to deal with blocking. In this version, there's still a "write_add_filter_none" that handles blocking, but I think I'll soon fold that down into the client wrapper and add_filter_none will become a no-op. I think this also gets us a big step closer to multi-volume support on the write side. SVN-Revision: 1920
Diffstat (limited to 'libarchive/archive_read_support_format_ar.c')
-rw-r--r--libarchive/archive_read_support_format_ar.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libarchive/archive_read_support_format_ar.c b/libarchive/archive_read_support_format_ar.c
index 7c1ca3a0..80c014a1 100644
--- a/libarchive/archive_read_support_format_ar.c
+++ b/libarchive/archive_read_support_format_ar.c
@@ -55,6 +55,7 @@ struct ar {
off_t entry_padding;
char *strtab;
size_t strtab_size;
+ char read_global_header;
};
/*
@@ -172,12 +173,13 @@ archive_read_format_ar_read_header(struct archive_read *a,
ar = (struct ar*)(a->format->data);
- if (a->archive.file_position == 0) {
+ if (!ar->read_global_header) {
/*
* We are now at the beginning of the archive,
* so we need first consume the ar global header.
*/
__archive_read_consume(a, 8);
+ ar->read_global_header = 1;
/* Set a default format code for now. */
a->archive.archive_format = ARCHIVE_FORMAT_AR;
}