summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_read.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-08-14 03:45:45 +0000
committerkientzle <kientzle@FreeBSD.org>2004-08-14 03:45:45 +0000
commit49a8ad2487b2329a538450200f1b1b2d698d6a23 (patch)
treec8c3ea449972625054a074cdd1e21e770642ffbb /lib/libarchive/archive_read.c
parent136013f29f7390ade8ad49fc70a7a0ef804d10b3 (diff)
downloadFreeBSD-src-49a8ad2487b2329a538450200f1b1b2d698d6a23.zip
FreeBSD-src-49a8ad2487b2329a538450200f1b1b2d698d6a23.tar.gz
Eliminate reliance on non-portable <err.h> by implementing a very
simple errx() function. Improve behavior when bzlib/zlib are missing by detecting and issuing an error message on attempts to read gzip/bzip2 compressed archives.
Diffstat (limited to 'lib/libarchive/archive_read.c')
-rw-r--r--lib/libarchive/archive_read.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/libarchive/archive_read.c b/lib/libarchive/archive_read.c
index 2f9a998..39ff7a8 100644
--- a/lib/libarchive/archive_read.c
+++ b/lib/libarchive/archive_read.c
@@ -35,7 +35,6 @@
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
-#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -110,8 +109,8 @@ archive_read_open(struct archive *a, void *client_data,
archive_check_magic(a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW);
if (reader == NULL)
- errx(1,
- "Fatal: No reader function provided to archive_read_open");
+ __archive_errx(1,
+ "No reader function provided to archive_read_open");
a->client_reader = reader;
a->client_opener = opener;
@@ -181,7 +180,7 @@ choose_decompressor(struct archive *a, const void *buffer, size_t bytes_read)
* and demands a quick and definitive abort.
*/
if (best_bid_slot < 0)
- errx(1, "Fatal: No decompressors were registered; you "
+ __archive_errx(1, "No decompressors were registered; you "
"must call at least one "
"archive_read_support_compression_XXX function in order "
"to successfully read an archive.");
@@ -304,7 +303,7 @@ choose_format(struct archive *a)
* and demands a quick and definitive abort.
*/
if (best_bid_slot < 0)
- errx(1, "Fatal: No formats were registered; you must "
+ __archive_errx(1, "No formats were registered; you must "
"invoke at least one archive_read_support_format_XXX "
"function in order to successfully read an archive.");
@@ -526,7 +525,8 @@ __archive_read_register_format(struct archive *a,
}
}
- errx(1, "Fatal: Not enough slots for format registration");
+ __archive_errx(1, "Not enough slots for format registration");
+ return (ARCHIVE_FATAL); /* Never actually called. */
}
/*
@@ -554,5 +554,6 @@ __archive_read_register_compression(struct archive *a,
}
}
- errx(1, "Fatal: Not enough slots for compression registration");
+ __archive_errx(1, "Not enough slots for compression registration");
+ return (ARCHIVE_FATAL); /* Never actually executed. */
}
OpenPOWER on IntegriCloud