diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-04-21 09:41:52 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-04-21 09:41:52 +0000 |
commit | 6cbf6ce16c45c4855ebddd3516465885e3c476d5 (patch) | |
tree | 299ce4fc08cb26cc0c0712c6b54de9c76893e7ca /wiretap/commview.c | |
parent | 0315e063e4267b97fc7716301350af07dd0f2bea (diff) | |
download | wireshark-6cbf6ce16c45c4855ebddd3516465885e3c476d5.tar.gz wireshark-6cbf6ce16c45c4855ebddd3516465885e3c476d5.tar.bz2 wireshark-6cbf6ce16c45c4855ebddd3516465885e3c476d5.zip |
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
Diffstat (limited to 'wiretap/commview.c')
-rw-r--r-- | wiretap/commview.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/wiretap/commview.c b/wiretap/commview.c index 4b4781663d..30fe21b768 100644 --- a/wiretap/commview.c +++ b/wiretap/commview.c @@ -82,23 +82,23 @@ typedef struct commview_header { #define MEDIUM_WIFI 1 #define MEDIUM_TOKEN_RING 2 -static gboolean commview_read(wtap *wth, int *err, gchar **err_info _U_, +static gboolean commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err, - gchar **err_info _U_); + gchar **err_info); static gboolean commview_read_header(commview_header_t *cv_hdr, FILE_T fh, - int *err); + int *err, gchar **err_info); static gboolean commview_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const union wtap_pseudo_header *pseudo_header _U_, const guchar *pd, int *err); -int commview_open(wtap *wth, int *err, gchar **err_info _U_) +int commview_open(wtap *wth, int *err, gchar **err_info) { commview_header_t cv_hdr; - if(!commview_read_header(&cv_hdr, wth->fh, err)) + if(!commview_read_header(&cv_hdr, wth->fh, err, err_info)) return -1; /* If any of these fields do not match what we expect, bail out. */ @@ -133,7 +133,7 @@ int commview_open(wtap *wth, int *err, gchar **err_info _U_) } static gboolean -commview_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset) +commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { commview_header_t cv_hdr; struct tm tm; @@ -141,7 +141,7 @@ commview_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset) *data_offset = wth->data_offset; - if(!commview_read_header(&cv_hdr, wth->fh, err)) + if(!commview_read_header(&cv_hdr, wth->fh, err, err_info)) return FALSE; wth->data_offset += COMMVIEW_HEADER_SIZE; @@ -170,7 +170,7 @@ commview_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset) bytes_read = file_read(buffer_start_ptr(wth->frame_buffer), cv_hdr.data_len, wth->fh); if(bytes_read != cv_hdr.data_len) { - *err = file_error(wth->fh); + *err = file_error(wth->fh, err_info); if(*err == 0) *err = WTAP_ERR_SHORT_READ; return FALSE; @@ -198,7 +198,7 @@ commview_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset) static gboolean commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err, - gchar **err_info _U_) + gchar **err_info) { commview_header_t cv_hdr; int bytes_read; @@ -206,7 +206,7 @@ commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header if(file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; - if(!commview_read_header(&cv_hdr, wth->random_fh, err)) { + if(!commview_read_header(&cv_hdr, wth->random_fh, err, err_info)) { if(*err == 0) *err = WTAP_ERR_SHORT_READ; @@ -229,7 +229,7 @@ commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header bytes_read = file_read(pd, cv_hdr.data_len, wth->random_fh); if(bytes_read != cv_hdr.data_len) { - *err = file_error(wth->random_fh); + *err = file_error(wth->random_fh, err_info); if(*err == 0) *err = WTAP_ERR_SHORT_READ; @@ -240,7 +240,8 @@ commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header } static gboolean -commview_read_header(commview_header_t *cv_hdr, FILE_T fh, int *err) +commview_read_header(commview_header_t *cv_hdr, FILE_T fh, int *err, + gchar **err_info) { int bytes_read = 0; @@ -270,7 +271,7 @@ commview_read_header(commview_header_t *cv_hdr, FILE_T fh, int *err) cv_hdr->usecs = GUINT32_FROM_LE(cv_hdr->usecs); if(bytes_read < COMMVIEW_HEADER_SIZE) { - *err = file_error(fh); + *err = file_error(fh, err_info); if(*err == 0 && bytes_read > 0) *err = WTAP_ERR_SHORT_READ; |