summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2007-04-16 04:04:50 +0000
committercperciva <cperciva@FreeBSD.org>2007-04-16 04:04:50 +0000
commit67c3258375e1a28f34a1419e1ef60e46fd03a684 (patch)
treecda739747030f2ad831dd044ecd406b516c18c7a /usr.bin/tar
parentb13ef47a114cd22729552751f5cbed3691083865 (diff)
downloadFreeBSD-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 'usr.bin/tar')
-rw-r--r--usr.bin/tar/read.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/usr.bin/tar/read.c b/usr.bin/tar/read.c
index 6507487..2e44c9e 100644
--- a/usr.bin/tar/read.c
+++ b/usr.bin/tar/read.c
@@ -223,11 +223,12 @@ read_archive(struct bsdtar *bsdtar, char mode)
archive_entry_pathname(entry));
fflush(stderr);
}
- if (bsdtar->option_stdout) {
- /* TODO: Catch/recover any errors here. */
- archive_read_data_into_fd(a, 1);
- } else if (archive_read_extract(a, entry,
- bsdtar->extract_flags)) {
+ if (bsdtar->option_stdout)
+ r = archive_read_data_into_fd(a, 1);
+ else
+ r = archive_read_extract(a, entry,
+ bsdtar->extract_flags);
+ if (r != ARCHIVE_OK) {
if (!bsdtar->verbose)
safe_fprintf(stderr, "%s",
archive_entry_pathname(entry));
@@ -235,14 +236,12 @@ read_archive(struct bsdtar *bsdtar, char mode)
archive_error_string(a));
if (!bsdtar->verbose)
fprintf(stderr, "\n");
- /*
- * TODO: Decide how to handle
- * extraction error... <sigh>
- */
bsdtar->return_value = 1;
}
if (bsdtar->verbose)
fprintf(stderr, "\n");
+ if (r == ARCHIVE_FATAL)
+ break;
}
}
OpenPOWER on IntegriCloud