summaryrefslogtreecommitdiff
path: root/tshark.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-12-17 20:03:47 -0800
committerGuy Harris <guy@alum.mit.edu>2014-12-18 04:04:19 +0000
commit0885d2945103236f7f475963f66048291f0b18f1 (patch)
tree2c165dd89f97ee9cc33d39f9b7a62840e0ab269b /tshark.c
parent6011a047d3cd2aba84e7fdd3bf7e8403a2f3563b (diff)
downloadwireshark-0885d2945103236f7f475963f66048291f0b18f1.tar.gz
Make sure err_info is always set, and print it iff it's non-null.
Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b Reviewed-on: https://code.wireshark.org/review/5830 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/tshark.c b/tshark.c
index cc2cdb3d2d..f96f49b930 100644
--- a/tshark.c
+++ b/tshark.c
@@ -3300,7 +3300,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
"Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
framenum, cf->filename,
wtap_file_type_subtype_short_string(out_file_type),
- err_info);
+ err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
break;
@@ -3403,7 +3403,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
"Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
framenum, cf->filename,
wtap_file_type_subtype_short_string(out_file_type),
- err_info);
+ err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
break;
@@ -3465,7 +3465,8 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
case WTAP_ERR_UNSUPPORTED:
cmdarg_err("The file \"%s\" contains record data that TShark doesn't support.\n(%s)",
- cf->filename, err_info);
+ cf->filename,
+ err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
break;
@@ -3476,13 +3477,15 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
case WTAP_ERR_BAD_FILE:
cmdarg_err("The file \"%s\" appears to be damaged or corrupt.\n(%s)",
- cf->filename, err_info);
+ cf->filename,
+ err_info != NULL ? err_info : "no information supplied");
g_free(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);
+ "(%s)", cf->filename,
+ err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
break;
@@ -4199,7 +4202,8 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
/* Seen only when opening a capture file for reading. */
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" contains record data that TShark doesn't support.\n"
- "(%s)", err_info);
+ "(%s)",
+ err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
errmsg = errmsg_errno;
break;
@@ -4238,8 +4242,9 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
case WTAP_ERR_BAD_FILE:
/* Seen only when opening a capture file for reading. */
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
- "The file \"%%s\" appears to be damaged or corrupt.\n"
- "(%s)", err_info);
+ "The file \"%%s\" appears to be damaged or corrupt.\n"
+ "(%s)",
+ err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
errmsg = errmsg_errno;
break;
@@ -4268,7 +4273,8 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
/* Seen only when opening a capture file for reading. */
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The compressed file \"%%s\" appears to be damaged or corrupt.\n"
- "(%s)", err_info);
+ "(%s)",
+ err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
errmsg = errmsg_errno;
break;