aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_wrappers.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-04-15 07:27:03 +0000
committerGuy Harris <guy@alum.mit.edu>2011-04-15 07:27:03 +0000
commitcd1a4b036cfb857140e3b9ab37fd19fbacde6e74 (patch)
treed6f459e12df8881b421bf4cf787db46de9415e3f /wiretap/file_wrappers.c
parent3e6bd6b55816064898401b0221e5854cad464561 (diff)
Return ENOMEM if we run out of memory. (We're either running on UN*X,
in which case ENOMEM is the right error, or we're running on Windows but using UN*Xy routines, in which case ENOMEM is the right error; unlike zlib, we don't have to run on a whole pile of OSes.) svn path=/trunk/; revision=36648
Diffstat (limited to 'wiretap/file_wrappers.c')
-rw-r--r--wiretap/file_wrappers.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index 4decfbd552..83e716b97e 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -320,13 +320,17 @@ zlib_read(FILE_T state, unsigned char *buf, unsigned int count)
break;
}
if (ret == Z_MEM_ERROR) {
- state->err = WTAP_ERR_ZLIB + Z_MEM_ERROR; /* ENOMEM? */
+ /* This means "not enough memory". */
+ state->err = ENOMEM;
break;
}
if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
state->err = WTAP_ERR_ZLIB + Z_DATA_ERROR;
break;
}
+ /*
+ * XXX - Z_BUF_ERROR?
+ */
strm->adler = crc32(strm->adler, buf2, count2 - strm->avail_out);
if (state->fast_seek_cur) {
@@ -1087,7 +1091,7 @@ gz_init(GZWFILE_T state)
if (state->in == NULL || state->out == NULL) {
g_free(state->out);
g_free(state->in);
- state->err = WTAP_ERR_ZLIB + Z_MEM_ERROR; /* ENOMEM? */
+ state->err = ENOMEM;
return -1;
}
@@ -1100,7 +1104,7 @@ gz_init(GZWFILE_T state)
if (ret != Z_OK) {
g_free(state->out);
g_free(state->in);
- state->err = WTAP_ERR_ZLIB + Z_MEM_ERROR; /* ENOMEM? */
+ state->err = WTAP_ERR_ZLIB + ret;
return -1;
}