diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-06-07 07:27:35 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-06-07 07:27:35 +0000 |
commit | 2aad75bb826b45ee1a78be2bbe2687e488748f8b (patch) | |
tree | fc165ec22e943d3b15a10b6c8c84359286432e05 /wiretap/ascend.c | |
parent | c15486768a2d90fcf97ca8ea628f3d174ad11a5b (diff) |
Graeme Hewson noted that zlib has a bug wherein "gzseek()" doesn't set
the internal z_err value for the stream if an "fseek()" call it makes
fails, so that if "gzerror()" is subsequently called, it returns Z_OK
rather than an error.
To work around this, we pass "file_seek()" an "int *err", and have the
with-zlib version of "file_seek()" check, if "gzseek()" fails, whether
the return value of "file_error()" is 0 and, if so, have it return
"errno" instead.
svn path=/trunk/; revision=5642
Diffstat (limited to 'wiretap/ascend.c')
-rw-r--r-- | wiretap/ascend.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/wiretap/ascend.c b/wiretap/ascend.c index 6710cadece..f3f97388f1 100644 --- a/wiretap/ascend.c +++ b/wiretap/ascend.c @@ -1,6 +1,6 @@ /* ascend.c * - * $Id: ascend.c,v 1.29 2002/03/05 08:39:29 guy Exp $ + * $Id: ascend.c,v 1.30 2002/06/07 07:27:34 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -227,10 +227,8 @@ found: * Move to where the read for this packet should start, and return * that seek offset. */ - if (file_seek(wth->fh, packet_off, SEEK_SET) == -1) { - *err = file_error(wth->fh); + if (file_seek(wth->fh, packet_off, SEEK_SET, err) == -1) return -1; - } return packet_off; } @@ -296,10 +294,8 @@ static gboolean ascend_read(wtap *wth, int *err, long *data_offset) offset after the header of the previous packet and try to find the next packet. */ if (file_seek(wth->fh, wth->capture.ascend->next_packet_seek_start, - SEEK_SET) == -1) { - *err = file_error(wth->fh); + SEEK_SET, err) == -1) return FALSE; - } offset = ascend_seek(wth, ASCEND_MAX_SEEK, err); if (offset == -1) return FALSE; @@ -343,10 +339,8 @@ static gboolean ascend_read(wtap *wth, int *err, long *data_offset) static gboolean ascend_seek_read (wtap *wth, long seek_off, union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, int *err) { - if (file_seek(wth->random_fh, seek_off, SEEK_SET) == -1) { - *err = file_error(wth->random_fh); + if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; - } if (! parse_ascend(wth->random_fh, pd, &pseudo_header->ascend, NULL, len)) { *err = WTAP_ERR_BAD_RECORD; return FALSE; |