diff options
author | cperciva <cperciva@FreeBSD.org> | 2007-04-07 03:37:59 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2007-04-07 03:37:59 +0000 |
commit | 08d3388bce7be05933d9dfcb05b77ad29e19d7f4 (patch) | |
tree | 7be90b2ddf87a9a0d70c9f3e273c914dd2546296 | |
parent | 9dfa1c4936324a285827d8652fc127d3be1e7627 (diff) | |
download | FreeBSD-src-08d3388bce7be05933d9dfcb05b77ad29e19d7f4.zip FreeBSD-src-08d3388bce7be05933d9dfcb05b77ad29e19d7f4.tar.gz |
When copying data from one archive to another, only set the error
message in the reader to the error message from the writer if the
error which occurred was in the writer. This avoids error messages
of "Empty error message" when extracting truncated archives.
-rw-r--r-- | lib/libarchive/archive_read_extract.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libarchive/archive_read_extract.c b/lib/libarchive/archive_read_extract.c index 4285d13..c4189f0 100644 --- a/lib/libarchive/archive_read_extract.c +++ b/lib/libarchive/archive_read_extract.c @@ -98,10 +98,6 @@ archive_read_extract(struct archive *_a, struct archive_entry *entry, int flags) if (r == ARCHIVE_OK) /* If there's an FD, pour data into it. */ r = copy_data(_a, a->extract->ad); - if (r != ARCHIVE_OK) - archive_set_error(&a->archive, - archive_errno(extract->ad), - "%s", archive_error_string(extract->ad)); r2 = archive_write_finish_entry(a->extract->ad); /* Use the first message. */ if (r2 != ARCHIVE_OK && r == ARCHIVE_OK) @@ -141,8 +137,11 @@ 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_OK) + if (r != ARCHIVE_OK) { + archive_set_error(ar, archive_errno(aw), + "%s", archive_error_string(aw)); return (r); + } } } |