From 2aad75bb826b45ee1a78be2bbe2687e488748f8b Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 7 Jun 2002 07:27:35 +0000 Subject: 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 --- wiretap/i4btrace.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'wiretap/i4btrace.c') diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c index 9b9eec2066..1ed623fd16 100644 --- a/wiretap/i4btrace.c +++ b/wiretap/i4btrace.c @@ -1,6 +1,6 @@ /* i4btrace.c * - * $Id: i4btrace.c,v 1.20 2002/04/09 08:15:04 guy Exp $ + * $Id: i4btrace.c,v 1.21 2002/06/07 07:27:34 guy Exp $ * * Wiretap Library * Copyright (c) 1999 by Bert Driehuis @@ -90,10 +90,8 @@ int i4btrace_open(wtap *wth, int *err) byte_swapped = TRUE; } - if (file_seek(wth->fh, 0, SEEK_SET) == -1) { - *err = file_error(wth->fh); + if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) return -1; - } wth->data_offset = 0; /* Get capture start time */ @@ -230,10 +228,8 @@ i4btrace_seek_read(wtap *wth, long seek_off, int ret; i4b_trace_hdr_t 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; - } /* Read record header. */ ret = i4b_read_rec_header(wth->random_fh, &hdr, err); -- cgit v1.2.1