diff options
author | cperciva <cperciva@FreeBSD.org> | 2007-04-16 04:04:50 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2007-04-16 04:04:50 +0000 |
commit | 67c3258375e1a28f34a1419e1ef60e46fd03a684 (patch) | |
tree | cda739747030f2ad831dd044ecd406b516c18c7a /lib/libarchive | |
parent | b13ef47a114cd22729552751f5cbed3691083865 (diff) | |
download | FreeBSD-src-67c3258375e1a28f34a1419e1ef60e46fd03a684.zip FreeBSD-src-67c3258375e1a28f34a1419e1ef60e46fd03a684.tar.gz |
In libarchive: Downgrade ARCHIVE_FATAL and ARCHIVE_FAILED errors which
occur on the write side of extracting a file to ARCHIVE_WARN errors
when returning them from archive_read_extract.
In bsdtar: Use the return code from archive_read_data_into_fd and
archive_read_extract to determine whether we should continue trying to
extract an archive after one of the entries fails.
This commit makes extracting a truncated tarball complain once about
the archive being truncated, instead of complaining twice (once when
trying to extract an entry, and once when trying to seek to the next
entry).
Discussed with: kientzle
Diffstat (limited to 'lib/libarchive')
-rw-r--r-- | lib/libarchive/archive_read_extract.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libarchive/archive_read_extract.c b/lib/libarchive/archive_read_extract.c index 8828ec6..464ebe9 100644 --- a/lib/libarchive/archive_read_extract.c +++ b/lib/libarchive/archive_read_extract.c @@ -95,6 +95,8 @@ archive_read_extract(struct archive *_a, struct archive_entry *entry, int flags) archive_write_disk_set_skip_file(a->extract->ad, a->skip_file_dev, a->skip_file_ino); r = archive_write_header(a->extract->ad, entry); + if (r < ARCHIVE_WARN) + r = ARCHIVE_WARN; if (r != ARCHIVE_OK) /* If _write_header failed, copy the error. */ archive_set_error(&a->archive, @@ -104,6 +106,8 @@ archive_read_extract(struct archive *_a, struct archive_entry *entry, int flags) /* Otherwise, pour data into the entry. */ r = copy_data(_a, a->extract->ad); r2 = archive_write_finish_entry(a->extract->ad); + if (r2 < ARCHIVE_WARN) + r2 = ARCHIVE_WARN; /* Use the first message. */ if (r2 != ARCHIVE_OK && r == ARCHIVE_OK) archive_set_error(&a->archive, @@ -142,6 +146,8 @@ copy_data(struct archive *ar, struct archive *aw) if (r != ARCHIVE_OK) return (r); r = archive_write_data_block(aw, buff, size, offset); + if (r < ARCHIVE_WARN) + r = ARCHIVE_WARN; if (r != ARCHIVE_OK) { archive_set_error(ar, archive_errno(aw), "%s", archive_error_string(aw)); |