aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/wtap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-10-05 07:06:08 +0000
committerGuy Harris <guy@alum.mit.edu>1999-10-05 07:06:08 +0000
commit5f7868c7e039265d585f79952d1cd1867ab5cf1e (patch)
treefc21365a3ed0d03130e733c2c10a8abe4aa946a2 /wiretap/wtap.c
parent03b75d6279db74fd3fd175cb572ea9340e452b65 (diff)
Better handle errors from zlib:
Assign a range of Wiretap errors for zlib errors, and have "wtap_strerror()" use "zError()" to get an error message for them. Have the internal "file_error()" routine return 0 for no error and a Wiretap error code for an error. svn path=/trunk/; revision=769
Diffstat (limited to 'wiretap/wtap.c')
-rw-r--r--wiretap/wtap.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index a8ad39fcbd..e4a85ec7ff 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -1,6 +1,6 @@
/* wtap.c
*
- * $Id: wtap.c,v 1.22 1999/09/24 05:49:53 guy Exp $
+ * $Id: wtap.c,v 1.23 1999/10/05 07:06:07 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -123,7 +123,15 @@ const char *wtap_strerror(int err)
if (err < 0) {
wtap_errlist_index = -1 - err;
if (wtap_errlist_index >= WTAP_ERRLIST_SIZE) {
- sprintf(errbuf, "Error %d", err);
+#ifdef HAVE_ZLIB
+ if (err >= WTAP_ERR_ZLIB_MIN
+ && err <= WTAP_ERR_ZLIB_MAX) {
+ /* Assume it's a zlib error. */
+ sprintf(errbuf, "Zlib error: %s",
+ zError(err));
+ } else
+#endif
+ sprintf(errbuf, "Error %d", err);
return errbuf;
}
if (wtap_errlist[wtap_errlist_index] == NULL)