From c2c19b10c7cbaeecb40cdd23fd5a95d7c6e213c1 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sat, 7 Apr 2007 05:56:40 +0000 Subject: [PATCH] Simplify the logic for handling header read errors. --- usr.bin/tar/read.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/usr.bin/tar/read.c b/usr.bin/tar/read.c index 1fec9ead5aa..92e0d8e31b9 100644 --- a/usr.bin/tar/read.c +++ b/usr.bin/tar/read.c @@ -122,19 +122,17 @@ read_archive(struct bsdtar *bsdtar, char mode) r = archive_read_next_header(a, &entry); if (r == ARCHIVE_EOF) break; - if (r == ARCHIVE_WARN) + if (r < ARCHIVE_OK) bsdtar_warnc(bsdtar, 0, "%s", archive_error_string(a)); - if (r == ARCHIVE_FATAL) { - bsdtar->return_value = 1; - bsdtar_warnc(bsdtar, 0, "%s", archive_error_string(a)); - break; - } if (r == ARCHIVE_RETRY) { /* Retryable error: try again */ - bsdtar_warnc(bsdtar, 0, "%s", archive_error_string(a)); bsdtar_warnc(bsdtar, 0, "Retrying..."); continue; } + if (r != ARCHIVE_OK) { + bsdtar->return_value = 1; + break; + } /* * Exclude entries that are too old.