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/netxray.c | |
parent | c15486768a2d90fcf97ca8ea628f3d174ad11a5b (diff) | |
download | wireshark-2aad75bb826b45ee1a78be2bbe2687e488748f8b.tar.gz wireshark-2aad75bb826b45ee1a78be2bbe2687e488748f8b.tar.bz2 wireshark-2aad75bb826b45ee1a78be2bbe2687e488748f8b.zip |
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/netxray.c')
-rw-r--r-- | wiretap/netxray.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/wiretap/netxray.c b/wiretap/netxray.c index 545fb1cc97..1500e92dde 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -1,6 +1,6 @@ /* netxray.c * - * $Id: netxray.c,v 1.55 2002/05/28 02:39:15 guy Exp $ + * $Id: netxray.c,v 1.56 2002/06/07 07:27:35 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -291,8 +291,7 @@ int netxray_open(wtap *wth, int *err) wth->capture.netxray->end_offset = pletohl(&hdr.end_offset); /* Seek to the beginning of the data records. */ - if (file_seek(wth->fh, pletohl(&hdr.start_offset), SEEK_SET) == -1) { - *err = file_error(wth->fh); + if (file_seek(wth->fh, pletohl(&hdr.start_offset), SEEK_SET, err) == -1) { g_free(wth->capture.netxray); return -1; } @@ -334,10 +333,8 @@ reread: /* Yes. Remember that we did. */ wth->capture.netxray->wrapped = TRUE; if (file_seek(wth->fh, CAPTUREFILE_HEADER_SIZE, - SEEK_SET) == -1) { - *err = file_error(wth->fh); + SEEK_SET, err) == -1) return FALSE; - } wth->data_offset = CAPTUREFILE_HEADER_SIZE; goto reread; } @@ -411,10 +408,8 @@ netxray_seek_read(wtap *wth, long seek_off, { union netxrayrec_hdr hdr; - 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 (!netxray_read_rec_header(wth, wth->random_fh, &hdr, err)) { if (*err == 0) { |