From 7ad21ca8c34279384b4609650e168a4fe648e39f Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Mon, 27 Apr 2009 18:33:08 +0000 Subject: [PATCH] Merge r1052,r1055 from libarchive.googlecode.com: Clear the error flag on entry to a few more API functions. --- lib/libarchive/archive_read_open_fd.c | 1 + lib/libarchive/archive_read_open_file.c | 1 + lib/libarchive/archive_read_open_filename.c | 1 + lib/libarchive/archive_read_support_compression_xz.c | 2 ++ 4 files changed, 5 insertions(+) diff --git a/lib/libarchive/archive_read_open_fd.c b/lib/libarchive/archive_read_open_fd.c index a7c2e29fd5f2..259ddc28be59 100644 --- a/lib/libarchive/archive_read_open_fd.c +++ b/lib/libarchive/archive_read_open_fd.c @@ -66,6 +66,7 @@ archive_read_open_fd(struct archive *a, int fd, size_t block_size) struct read_fd_data *mine; void *b; + archive_clear_error(a); if (fstat(fd, &st) != 0) { archive_set_error(a, errno, "Can't stat fd %d", fd); return (ARCHIVE_FATAL); diff --git a/lib/libarchive/archive_read_open_file.c b/lib/libarchive/archive_read_open_file.c index e77d4471c94d..37039e95a111 100644 --- a/lib/libarchive/archive_read_open_file.c +++ b/lib/libarchive/archive_read_open_file.c @@ -70,6 +70,7 @@ archive_read_open_FILE(struct archive *a, FILE *f) size_t block_size = 128 * 1024; void *b; + archive_clear_error(a); mine = (struct read_FILE_data *)malloc(sizeof(*mine)); b = malloc(block_size); if (mine == NULL || b == NULL) { diff --git a/lib/libarchive/archive_read_open_filename.c b/lib/libarchive/archive_read_open_filename.c index e86a93d2b3d0..356fae9d61fb 100644 --- a/lib/libarchive/archive_read_open_filename.c +++ b/lib/libarchive/archive_read_open_filename.c @@ -84,6 +84,7 @@ archive_read_open_filename(struct archive *a, const char *filename, void *b; int fd; + archive_clear_error(a); if (filename == NULL || filename[0] == '\0') return (archive_read_open_fd(a, 0, block_size)); diff --git a/lib/libarchive/archive_read_support_compression_xz.c b/lib/libarchive/archive_read_support_compression_xz.c index a3c9553c92e0..d3f429786790 100644 --- a/lib/libarchive/archive_read_support_compression_xz.c +++ b/lib/libarchive/archive_read_support_compression_xz.c @@ -100,6 +100,7 @@ archive_read_support_compression_xz(struct archive *_a) struct archive_read *a = (struct archive_read *)_a; struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a); + archive_clear_error(_a); if (bidder == NULL) return (ARCHIVE_FATAL); @@ -123,6 +124,7 @@ archive_read_support_compression_lzma(struct archive *_a) struct archive_read *a = (struct archive_read *)_a; struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a); + archive_clear_error(_a); if (bidder == NULL) return (ARCHIVE_FATAL);