Fix it so that it builds with "--disable-zlib".

The "fh" member of a "wtap" structure points to something constructed
from the "fd" member of that structure, so that closing the stream
referred to by "fh" also closes the underlying file descriptor; get rid
of an unnecessary close of "wth->fd".

svn path=/trunk/; revision=720
This commit is contained in:
Guy Harris 1999-09-24 05:49:53 +00:00
parent 702b8f7aed
commit a9c36a4b69
12 changed files with 30 additions and 29 deletions

View File

@ -1,6 +1,6 @@
/* file.c
*
* $Id: file.c,v 1.23 1999/09/23 05:00:59 guy Exp $
* $Id: file.c,v 1.24 1999/09/24 05:49:50 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -29,8 +29,8 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "buffer.h"
#include "lanalyzer.h"
#include "ngsniffer.h"
@ -130,7 +130,6 @@ wtap* wtap_open_offline(const char *filename, int *err)
/* I/O error - give up */
*err = errno;
file_close(wth->fh);
close(wth->fd);
free(wth);
return NULL;

View File

@ -1,6 +1,6 @@
/* file.h
*
* $Id: file.h,v 1.2 1999/09/22 07:37:46 ashokn Exp $
* $Id: file.h,v 1.3 1999/09/24 05:49:50 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -25,9 +25,6 @@
#define __FILE_H__
#ifdef HAVE_LIBZ
#include "zlib.h"
#define FILE_T gzFile
#define file_open gzopen
#define filed_open gzdopen
#define file_seek gzseek
@ -44,7 +41,6 @@ static inline int file_error(void *fh) {
}
#else /* No zLib */
#define FILE_T FILE *
#define file_open fopen
#define filed_open fdopen
#define file_seek fseek

View File

@ -1,6 +1,6 @@
/* iptrace.c
*
* $Id: iptrace.c,v 1.11 1999/09/22 01:26:46 ashokn Exp $
* $Id: iptrace.c,v 1.12 1999/09/24 05:49:50 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -27,8 +27,8 @@
#include <errno.h>
#include <time.h>
#include <string.h>
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "buffer.h"
#include "iptrace.h"

View File

@ -1,6 +1,6 @@
/* lanalyzer.c
*
* $Id: lanalyzer.c,v 1.15 1999/09/22 01:26:47 ashokn Exp $
* $Id: lanalyzer.c,v 1.16 1999/09/24 05:49:51 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -26,8 +26,8 @@
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "buffer.h"
#include "lanalyzer.h"

View File

@ -1,6 +1,6 @@
/* libpcap.c
*
* $Id: libpcap.c,v 1.19 1999/09/23 05:00:59 guy Exp $
* $Id: libpcap.c,v 1.20 1999/09/24 05:49:51 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -25,8 +25,8 @@
#endif
#include <stdlib.h>
#include <errno.h>
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "buffer.h"
#include "libpcap.h"

View File

@ -1,6 +1,6 @@
/* netmon.c
*
* $Id: netmon.c,v 1.14 1999/09/22 01:26:47 ashokn Exp $
* $Id: netmon.c,v 1.15 1999/09/24 05:49:51 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -25,8 +25,8 @@
#endif
#include <errno.h>
#include <time.h>
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "buffer.h"
#include "netmon.h"

View File

@ -1,6 +1,6 @@
/* netxray.c
*
* $Id: netxray.c,v 1.14 1999/09/22 01:26:48 ashokn Exp $
* $Id: netxray.c,v 1.15 1999/09/24 05:49:51 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -27,8 +27,8 @@
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "netxray.h"
#include "buffer.h"

View File

@ -1,6 +1,6 @@
/* ngsniffer.c
*
* $Id: ngsniffer.c,v 1.22 1999/09/22 01:26:48 ashokn Exp $
* $Id: ngsniffer.c,v 1.23 1999/09/24 05:49:52 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -62,8 +62,8 @@
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "buffer.h"
#include "ngsniffer.h"

View File

@ -1,6 +1,6 @@
/* radcom.c
*
* $Id: radcom.c,v 1.11 1999/09/23 05:03:32 guy Exp $
* $Id: radcom.c,v 1.12 1999/09/24 05:49:52 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -27,8 +27,8 @@
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "buffer.h"
#include "radcom.h"

View File

@ -1,6 +1,6 @@
/* snoop.c
*
* $Id: snoop.c,v 1.11 1999/09/22 01:26:49 ashokn Exp $
* $Id: snoop.c,v 1.12 1999/09/24 05:49:52 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -24,8 +24,8 @@
#include "config.h"
#endif
#include <errno.h>
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "buffer.h"
#include "snoop.h"
#ifdef HAVE_NETINET_IN_H

View File

@ -1,6 +1,6 @@
/* wtap.c
*
* $Id: wtap.c,v 1.21 1999/09/23 04:39:00 ashokn Exp $
* $Id: wtap.c,v 1.22 1999/09/24 05:49:53 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -26,8 +26,8 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "file.h"
#include "wtap.h"
#include "file.h"
#include "buffer.h"
#include "ascend.h"

View File

@ -1,6 +1,6 @@
/* wtap.h
*
* $Id: wtap.h,v 1.40 1999/09/23 04:39:01 ashokn Exp $
* $Id: wtap.h,v 1.41 1999/09/24 05:49:53 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@ -129,6 +129,13 @@
#include <glib.h>
#include <stdio.h>
#ifdef HAVE_LIBZ
#include "zlib.h"
#define FILE_T gzFile
#else /* No zLib */
#define FILE_T FILE *
#endif /* HAVE_LIBZ */
typedef struct {
double timeunit;
time_t start;
@ -282,8 +289,7 @@ struct Buffer;
typedef int (*subtype_read_func)(struct wtap*, int*);
typedef struct wtap {
/* FILE_T fh; */
void * fh;
FILE_T fh;
int fd; /* File descriptor for cap file */
int file_type;
int snapshot_length;