aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/dct3trace.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-04-21 09:41:52 +0000
committerGuy Harris <guy@alum.mit.edu>2011-04-21 09:41:52 +0000
commit6cbf6ce16c45c4855ebddd3516465885e3c476d5 (patch)
tree299ce4fc08cb26cc0c0712c6b54de9c76893e7ca /wiretap/dct3trace.c
parent0315e063e4267b97fc7716301350af07dd0f2bea (diff)
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/dct3trace.c')
-rw-r--r--wiretap/dct3trace.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/wiretap/dct3trace.c b/wiretap/dct3trace.c
index b64c5bc8b4..251261f0cd 100644
--- a/wiretap/dct3trace.c
+++ b/wiretap/dct3trace.c
@@ -162,9 +162,10 @@ xml_get_int(int *val, const unsigned char *str, const unsigned char *pattern)
* a DCT3 trace file.
*
* Returns TRUE if it is, FALSE if it isn't or if we get an I/O error;
- * if we get an I/O error, "*err" will be set to a non-zero value.
+ * if we get an I/O error, "*err" will be set to a non-zero value
+ * and "*err_info" will be set to null or an additional error string.
*/
-static gboolean dct3trace_check_file_type(wtap *wth, int *err)
+static gboolean dct3trace_check_file_type(wtap *wth, int *err, gchar **err_info)
{
char line1[64], line2[64];
@@ -184,17 +185,17 @@ static gboolean dct3trace_check_file_type(wtap *wth, int *err)
if (file_eof(wth->fh))
*err = 0;
else
- *err = file_error(wth->fh);
+ *err = file_error(wth->fh, err_info);
}
return FALSE;
}
-int dct3trace_open(wtap *wth, int *err, gchar **err_info _U_)
+int dct3trace_open(wtap *wth, int *err, gchar **err_info)
{
/* Look for Gammu DCT3 trace header */
- if (!dct3trace_check_file_type(wth, err))
+ if (!dct3trace_check_file_type(wth, err, err_info))
{
if (*err == 0)
return 0;
@@ -328,7 +329,7 @@ static gboolean dct3trace_get_packet(FILE_T fh, union wtap_pseudo_header *pseudo
}
}
- *err = file_error(fh);
+ *err = file_error(fh, err_info);
if (*err == 0)
{
*err = WTAP_ERR_SHORT_READ;