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/csids.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/csids.c')
-rw-r--r-- | wiretap/csids.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/wiretap/csids.c b/wiretap/csids.c index fd830246d8..ce819a71d3 100644 --- a/wiretap/csids.c +++ b/wiretap/csids.c @@ -1,6 +1,6 @@ /* csids.c * - * $Id: csids.c,v 1.13 2002/03/05 08:39:29 guy Exp $ + * $Id: csids.c,v 1.14 2002/06/07 07:27:34 guy Exp $ * * Copyright (c) 2000 by Mike Hall <mlh@io.com> * Copyright (c) 2000 by Cisco Systems @@ -124,10 +124,8 @@ int csids_open(wtap *wth, int *err) } /* no file header. So reset the fh to 0 so we can read the first packet */ - 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; wth->capture.csids = g_malloc(sizeof(csids_t)); @@ -208,10 +206,8 @@ csids_seek_read (wtap *wth, int bytesRead; struct csids_header 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; - } bytesRead = file_read( &hdr, 1, sizeof( struct csids_header), wth->random_fh ); if( bytesRead != sizeof( struct csids_header) ) { |