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 --- rawshark.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'rawshark.c') diff --git a/rawshark.c b/rawshark.c index d1e08b98cf..4481a41f55 100644 --- a/rawshark.c +++ b/rawshark.c @@ -990,27 +990,32 @@ load_cap_file(capture_file *cf) switch (err) { case WTAP_ERR_UNSUPPORTED_ENCAP: - cmdarg_err("\"%s\" has a packet with a network type that Rawshark doesn't support.\n(%s)", + cmdarg_err("The file \"%s\" has a packet with a network type that Rawshark doesn't support.\n(%s)", cf->filename, err_info); break; case WTAP_ERR_CANT_READ: - cmdarg_err("An attempt to read from \"%s\" failed for some unknown reason.", + cmdarg_err("An attempt to read from the file \"%s\" failed for some unknown reason.", cf->filename); break; case WTAP_ERR_SHORT_READ: - cmdarg_err("\"%s\" appears to have been cut short in the middle of a packet.", + cmdarg_err("The file \"%s\" appears to have been cut short in the middle of a packet.", cf->filename); break; case WTAP_ERR_BAD_RECORD: - cmdarg_err("\"%s\" appears to be damaged or corrupt.\n(%s)", + cmdarg_err("The file \"%s\" appears to be damaged or corrupt.\n(%s)", + cf->filename, err_info); + break; + + case WTAP_ERR_DECOMPRESS: + cmdarg_err("The compressed file \"%s\" appears to be damaged or corrupt.\n(%s)", cf->filename, err_info); break; default: - cmdarg_err("An error occurred while reading \"%s\": %s.", + cmdarg_err("An error occurred while reading the file \"%s\": %s.", cf->filename, wtap_strerror(err)); break; } -- cgit v1.2.3