aboutsummaryrefslogtreecommitdiffstats
path: root/file.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 /file.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 'file.c')
-rw-r--r--file.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/file.c b/file.c
index 075d688f04..a7f203931d 100644
--- a/file.c
+++ b/file.c
@@ -742,6 +742,14 @@ cf_read(capture_file *cf, gboolean from_save)
errmsg = errmsg_errno;
break;
+ case WTAP_ERR_DECOMPRESS:
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
+ "The compressed capture file appears to be damaged or corrupt.\n"
+ "(%s)", err_info);
+ g_free(err_info);
+ errmsg = errmsg_errno;
+ break;
+
default:
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"An error occurred while reading the"
@@ -1448,6 +1456,14 @@ cf_merge_files(char **out_filenamep, int in_file_count,
errmsg = errmsg_errno;
break;
+ case WTAP_ERR_DECOMPRESS:
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
+ "The compressed capture file %%s appears to be damaged or corrupt.\n"
+ "(%s)", err_info);
+ g_free(err_info);
+ errmsg = errmsg_errno;
+ break;
+
default:
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"An error occurred while reading the"
@@ -3910,6 +3926,13 @@ cf_open_failure_alert_box(const char *filename, int err, gchar *err_info,
"Gzip compression not supported by this file type.");
break;
+ case WTAP_ERR_DECOMPRESS:
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "The compressed file \"%s\" appears to be damaged or corrupt.\n"
+ "(%s)", filename, err_info);
+ g_free(err_info);
+ break;
+
default:
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"The file \"%s\" could not be %s: %s.",