From 6cbf6ce16c45c4855ebddd3516465885e3c476d5 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 21 Apr 2011 09:41:52 +0000 Subject: Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discovered by the gunzipping code. Have it also supply a err_info string, and report it. Have file_error() supply an err_info string. Put "the file" - or, for WTAP_ERR_DECOMPRESS, "the compressed file", to suggest a decompression error - into the rawshark and tshark errors, along the lines of what other programs print. Fix a case in the Netscaler code where we weren't fetching the error code on a read failure. svn path=/trunk/; revision=36748 --- wiretap/csids.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'wiretap/csids.c') diff --git a/wiretap/csids.c b/wiretap/csids.c index 542062ea15..2b5226e402 100644 --- a/wiretap/csids.c +++ b/wiretap/csids.c @@ -61,7 +61,7 @@ typedef struct { } csids_t; /* XXX - return -1 on I/O error and actually do something with 'err'. */ -int csids_open(wtap *wth, int *err, gchar **err_info _U_) +int csids_open(wtap *wth, int *err, gchar **err_info) { /* There is no file header. There is only a header for each packet * so we read a packet header and compare the caplen with iplen. They @@ -80,7 +80,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info _U_) /* check the file to make sure it is a csids file. */ bytesRead = file_read( &hdr, sizeof( struct csids_header), wth->fh ); if( bytesRead != sizeof( struct csids_header) ) { - *err = file_error( wth->fh ); + *err = file_error( wth->fh, err_info ); if( *err != 0 ) { return -1; } else { @@ -94,7 +94,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info _U_) hdr.caplen = pntohs( &hdr.caplen ); bytesRead = file_read( &tmp, 2, wth->fh ); if( bytesRead != 2 ) { - *err = file_error( wth->fh ); + *err = file_error( wth->fh, err_info ); if( *err != 0 ) { return -1; } else { @@ -103,7 +103,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info _U_) } bytesRead = file_read( &iplen, 2, wth->fh ); if( bytesRead != 2 ) { - *err = file_error( wth->fh ); + *err = file_error( wth->fh, err_info ); if( *err != 0 ) { return -1; } else { @@ -151,7 +151,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info _U_) } /* Find the next packet and parse it; called from wtap_read(). */ -static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_, +static gboolean csids_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { csids_t *csids = (csids_t *)wth->priv; @@ -163,7 +163,7 @@ static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_, bytesRead = file_read( &hdr, sizeof( struct csids_header) , wth->fh ); if( bytesRead != sizeof( struct csids_header) ) { - *err = file_error( wth->fh ); + *err = file_error( wth->fh, err_info ); if (*err == 0 && bytesRead != 0) *err = WTAP_ERR_SHORT_READ; return FALSE; @@ -179,7 +179,7 @@ static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_, bytesRead = file_read( buf, hdr.caplen, wth->fh ); if( bytesRead != hdr.caplen ) { - *err = file_error( wth->fh ); + *err = file_error( wth->fh, err_info ); if (*err == 0) *err = WTAP_ERR_SHORT_READ; return FALSE; @@ -220,7 +220,7 @@ csids_seek_read (wtap *wth, bytesRead = file_read( &hdr, sizeof( struct csids_header), wth->random_fh ); if( bytesRead != sizeof( struct csids_header) ) { - *err = file_error( wth->random_fh ); + *err = file_error( wth->random_fh, err_info ); if( *err == 0 ) { *err = WTAP_ERR_SHORT_READ; } @@ -238,7 +238,7 @@ csids_seek_read (wtap *wth, bytesRead = file_read( pd, hdr.caplen, wth->random_fh ); if( bytesRead != hdr.caplen ) { - *err = file_error( wth->random_fh ); + *err = file_error( wth->random_fh, err_info ); if( *err == 0 ) { *err = WTAP_ERR_SHORT_READ; } -- cgit v1.2.1