diff options
author | mm <mm@FreeBSD.org> | 2013-03-22 13:36:03 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2013-03-22 13:36:03 +0000 |
commit | 5ee0a7b76c4addc27bb45864cb4e0ce790a4b80e (patch) | |
tree | e741e3532b574e7c25aa9bb07c18cdb16139824f /contrib/libarchive/tar/read.c | |
parent | af89cb16bfde2fc8e93708b89daff55026d3b216 (diff) | |
parent | 366f42737cba40ceb2e83af8d17c61c0242703c5 (diff) | |
download | FreeBSD-src-5ee0a7b76c4addc27bb45864cb4e0ce790a4b80e.zip FreeBSD-src-5ee0a7b76c4addc27bb45864cb4e0ce790a4b80e.tar.gz |
MFV r248590,248594:
Update libarchive to 3.1.2
Some of new features:
- support for lrzip and grzip compression
- support for writing tar v7 format
- b64encode and uuencode filters
- support for __MACOSX directory in Zip archives
- support for lzop compresion (external utility)
Diffstat (limited to 'contrib/libarchive/tar/read.c')
-rw-r--r-- | contrib/libarchive/tar/read.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/contrib/libarchive/tar/read.c b/contrib/libarchive/tar/read.c index 87ee735..67a6600 100644 --- a/contrib/libarchive/tar/read.c +++ b/contrib/libarchive/tar/read.c @@ -125,8 +125,8 @@ progress_func(void *cookie) if (bsdtar->verbose) fprintf(stderr, "\n"); if (a != NULL) { - comp = archive_position_compressed(a); - uncomp = archive_position_uncompressed(a); + comp = archive_filter_bytes(a, -1); + uncomp = archive_filter_bytes(a, 0); if (comp > uncomp) compression = 0; else @@ -155,6 +155,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) FILE *out; struct archive *a; struct archive_entry *entry; + const char *reader_options; int r; while (*bsdtar->argv) { @@ -173,14 +174,35 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) archive_error_string(bsdtar->matching)); a = archive_read_new(); - if (bsdtar->compress_program != NULL) - archive_read_support_filter_program(a, bsdtar->compress_program); - else + if (cset_read_support_filter_program(bsdtar->cset, a) == 0) archive_read_support_filter_all(a); archive_read_support_format_all(a); + + reader_options = getenv(ENV_READER_OPTIONS); + if (reader_options != NULL) { + char *p; + /* Set default read options. */ + p = malloc(sizeof(IGNORE_WRONG_MODULE_NAME) + + strlen(reader_options) + 1); + if (p == NULL) + lafe_errc(1, errno, "Out of memory"); + /* Prepend magic code to ignore options for + * a format or modules which are not added to + * the archive read object. */ + strncpy(p, IGNORE_WRONG_MODULE_NAME, + sizeof(IGNORE_WRONG_MODULE_NAME) -1); + strcpy(p + sizeof(IGNORE_WRONG_MODULE_NAME) -1, reader_options); + r = archive_read_set_options(a, p); + free(p); + if (r == ARCHIVE_FATAL) + lafe_errc(1, 0, "%s", archive_error_string(a)); + else + archive_clear_error(a); + } if (ARCHIVE_OK != archive_read_set_options(a, bsdtar->option_options)) lafe_errc(1, 0, "%s", archive_error_string(a)); - if (archive_read_open_file(a, bsdtar->filename, bsdtar->bytes_per_block)) + if (archive_read_open_filename(a, bsdtar->filename, + bsdtar->bytes_per_block)) lafe_errc(1, 0, "Error opening archive: %s", archive_error_string(a)); @@ -338,7 +360,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (bsdtar->verbose > 2) fprintf(stdout, "Archive Format: %s, Compression: %s\n", - archive_format_name(a), archive_compression_name(a)); + archive_format_name(a), archive_filter_name(a, 0)); archive_read_free(a); } |