diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-06-07 07:27:35 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-06-07 07:27:35 +0000 |
commit | cfc912ef0ce1948bd6738533390303874d9fd44b (patch) | |
tree | fc165ec22e943d3b15a10b6c8c84359286432e05 /wiretap/netxray.c | |
parent | 8508f775b09925ad4cc117c972dc821a3568afe0 (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.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5642 f5534014-38df-0310-8fa8-9805f1628bb7
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) { |