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/tnef.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'wiretap/tnef.c') diff --git a/wiretap/tnef.c b/wiretap/tnef.c index b0aebb0fe6..ce839fcc13 100644 --- a/wiretap/tnef.c +++ b/wiretap/tnef.c @@ -68,7 +68,7 @@ static gboolean tnef_read(wtap *wth, int *err, gchar **err_info, gint64 *data_of buffer_assure_space(wth->frame_buffer, packet_size); buf = buffer_start_ptr(wth->frame_buffer); - wtap_file_read_expected_bytes(buf, packet_size, wth->fh, err); + wtap_file_read_expected_bytes(buf, packet_size, wth->fh, err, err_info); wth->data_offset += packet_size; @@ -88,7 +88,7 @@ static gboolean tnef_read(wtap *wth, int *err, gchar **err_info, gint64 *data_of static gboolean tnef_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header _U_, - guint8 *pd, int length, int *err, gchar **err_info _U_) + guint8 *pd, int length, int *err, gchar **err_info) { int packet_size = length; @@ -101,19 +101,19 @@ static gboolean tnef_seek_read(wtap *wth, gint64 seek_off, if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; - wtap_file_read_expected_bytes(pd, packet_size, wth->random_fh, err); + wtap_file_read_expected_bytes(pd, packet_size, wth->random_fh, err, err_info); return TRUE; } -int tnef_open(wtap *wth, int *err, gchar **err_info _U_) +int tnef_open(wtap *wth, int *err, gchar **err_info) { int bytes_read; guint32 magic; bytes_read = file_read(&magic, sizeof magic, wth->fh); if (bytes_read != sizeof magic) { - *err = file_error(wth->fh); + *err = file_error(wth->fh, err_info); return (*err != 0) ? -1 : 0; } -- cgit v1.2.3