summaryrefslogtreecommitdiff
path: root/libarchive/archive_read_support_format_raw.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@gmail.com>2010-03-01 00:36:29 -0500
committerTim Kientzle <kientzle@gmail.com>2010-03-01 00:36:29 -0500
commit42c1f3e1243e684bc003d857450496a274d16a31 (patch)
tree9cb18cff0a6a3f22efa65645d6f6d16f053d308e /libarchive/archive_read_support_format_raw.c
parent061edc88add6320353d46c385829e6e16b0e4e89 (diff)
downloadlibarchive-42c1f3e1243e684bc003d857450496a274d16a31.tar.gz
Open a door to changing the current abort-on-state-failure behavior:
* Change __archive_check_magic to return a status code. * Change callers to use the archive_check_magic() wrapper macro, which calls __archive_check_magic and returns immediately if there's an ARCHIVE_FATAL status. * Update a bunch of API calls to actually do magic state checks. I've also changed __archive_check_magic around a little bit: * Magic number checks still call abort(). * State failures still call abort() * Starting with libarchive 3.0, state failures will return ARCHIVE_FATAL. SVN-Revision: 2003
Diffstat (limited to 'libarchive/archive_read_support_format_raw.c')
-rw-r--r--libarchive/archive_read_support_format_raw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libarchive/archive_read_support_format_raw.c b/libarchive/archive_read_support_format_raw.c
index 89e6940d..ea7b26c3 100644
--- a/libarchive/archive_read_support_format_raw.c
+++ b/libarchive/archive_read_support_format_raw.c
@@ -63,6 +63,9 @@ archive_read_support_format_raw(struct archive *_a)
struct archive_read *a = (struct archive_read *)_a;
int r;
+ archive_check_magic(_a, ARCHIVE_READ_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_read_support_format_raw");
+
info = (struct raw_info *)calloc(1, sizeof(*info));
if (info == NULL) {
archive_set_error(&a->archive, ENOMEM,