diff options
| author | Tim Kientzle <kientzle@FreeBSD.org> | 2009-04-17 00:55:52 +0000 |
|---|---|---|
| committer | Tim Kientzle <kientzle@FreeBSD.org> | 2009-04-17 00:55:52 +0000 |
| commit | 06f39cd345eb77dcfaa05c430cde8808ffacd1ac (patch) | |
| tree | 4255288ed98ea6e2cf54e92253ab99274a543593 /lib/libarchive/archive_read_support_compression_bzip2.c | |
| parent | c9f05bc8a1d213ca00614d14840f97caa80bc11e (diff) | |
Notes
Diffstat (limited to 'lib/libarchive/archive_read_support_compression_bzip2.c')
| -rw-r--r-- | lib/libarchive/archive_read_support_compression_bzip2.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/libarchive/archive_read_support_compression_bzip2.c b/lib/libarchive/archive_read_support_compression_bzip2.c index 506dcfebff9c0..693bdd63b707c 100644 --- a/lib/libarchive/archive_read_support_compression_bzip2.c +++ b/lib/libarchive/archive_read_support_compression_bzip2.c @@ -86,7 +86,13 @@ archive_read_support_compression_bzip2(struct archive *_a) reader->init = bzip2_reader_init; reader->options = NULL; reader->free = bzip2_reader_free; +#if HAVE_BZLIB_H return (ARCHIVE_OK); +#else + archive_set_error(_a, ARCHIVE_ERRNO_MISC, + "Using external bunzip2 program"); + return (ARCHIVE_WARN); +#endif } static int @@ -150,10 +156,15 @@ bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_fi static int bzip2_reader_init(struct archive_read_filter *self) { + int r; - archive_set_error(&self->archive->archive, -1, - "This version of libarchive was compiled without bzip2 support"); - return (ARCHIVE_FATAL); + r = __archive_read_program(self, "bunzip2"); + /* Note: We set the format here even if __archive_read_program() + * above fails. We do, after all, know what the format is + * even if we weren't able to read it. */ + self->code = ARCHIVE_COMPRESSION_BZIP2; + self->name = "bzip2"; + return (r); } |
