Ethereal-dev: Re: [ethereal-dev] zlib support issue

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date: Tue, 25 Jan 2000 13:31:02 +0900
>>Note that the behavior you describe on NetBSD 1.4.1 also applies to
>>FreeBSD 3.3, and the code in the CVS tree works fine in FreeBSD 3.3 when
>>built with zlib.
>	It looks that, on NetBSD 1.4.1,
>	- binary built with "./configure" will see corrupted packet dump
>	- binary built with "./configure --disable-zlib" works just fine
>	so I think I need to take a deep look at file_wrappers.c.
>	I'll try to send you better diffs later.

	This fixed my problem.  The thing is that gztell() is affected
	by z_off_t flaw, not only gzseek().

	The workaround is not friendly with *.gz files that are > 2G.
	(and zlib 1.1.3 has a bug inside - hardcodes off_t to unsigned long
	in internal structs)  How should we address this issue?

itojun
? aclocal.m4-
Index: wiretap/file_wrappers.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/wiretap/file_wrappers.c,v
retrieving revision 1.3
diff -c -r1.3 file_wrappers.c
*** file_wrappers.c	2000/01/22 06:22:37	1.3
--- file_wrappers.c	2000/01/25 04:27:53
***************
*** 84,93 ****
  int
  file_seek(void *stream, long offset, int whence)
  {
! 	return gzseek(stream, offset, whence);
  }
  #else /* HAVE_LIBZ */
! int
  file_seek(FILE *stream, long offset, int whence)
  {
  	return fseek(stream, offset, whence);
--- 84,99 ----
  int
  file_seek(void *stream, long offset, int whence)
  {
! 	return gzseek(stream, (z_off_t)offset, whence);
  }
+ 
+ long
+ file_tell(void *stream)
+ {
+ 	return (long)gztell(stream);
+ }
  #else /* HAVE_LIBZ */
! long
  file_seek(FILE *stream, long offset, int whence)
  {
  	return fseek(stream, offset, whence);
Index: wiretap/file_wrappers.h
===================================================================
RCS file: /usr/local/cvsroot/ethereal/wiretap/file_wrappers.h,v
retrieving revision 1.2
diff -c -r1.2 file_wrappers.h
*** file_wrappers.h	2000/01/22 06:22:37	1.2
--- file_wrappers.h	2000/01/25 04:27:53
***************
*** 31,37 ****
  #define file_read(buf, bsize, count, file) gzread((file),(buf),((count)*(bsize)))
  #define file_write(buf, bsize, count, file) gzwrite((file),(buf),((count)*(bsize)))
  #define file_close gzclose
! #define file_tell gztell
  #define file_getc gzgetc
  #define file_gets(buf, len, file) gzgets((file), (buf), (len))
  extern int file_error(void *fh);
--- 31,37 ----
  #define file_read(buf, bsize, count, file) gzread((file),(buf),((count)*(bsize)))
  #define file_write(buf, bsize, count, file) gzwrite((file),(buf),((count)*(bsize)))
  #define file_close gzclose
! extern long file_tell(void *stream);
  #define file_getc gzgetc
  #define file_gets(buf, len, file) gzgets((file), (buf), (len))
  extern int file_error(void *fh);