summaryrefslogtreecommitdiff
path: root/ui/failure_message.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-04-20 14:07:06 -0700
committerGuy Harris <guy@alum.mit.edu>2017-04-20 21:07:35 +0000
commit804d3f62454895c1560a690728b859f68ee35bf6 (patch)
tree1a1597cdb4f3fadc9187e2243bcae372ca680a4c /ui/failure_message.c
parent64ec2b2e5ed590a6f1a3d22c8b24a6e70420d1f9 (diff)
downloadwireshark-804d3f62454895c1560a690728b859f68ee35bf6.tar.gz
Use cfile_write_failure_message() in the randpkt code.
Change-Id: I32ef7ff85f854782e5dd02c3e7f12436a120bc13 Reviewed-on: https://code.wireshark.org/review/21259 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/failure_message.c')
-rw-r--r--ui/failure_message.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/ui/failure_message.c b/ui/failure_message.c
index 5a6a0f3d43..7626562987 100644
--- a/ui/failure_message.c
+++ b/ui/failure_message.c
@@ -292,10 +292,18 @@ cfile_write_failure_message(const char *progname, const char *in_filename,
guint32 framenum, int file_type_subtype)
{
char *in_file_string;
+ char *in_frame_string;
char *out_file_string;
/* Get a string that describes what we're reading from */
- in_file_string = input_file_description(in_filename);
+ if (in_filename == NULL) {
+ in_frame_string = g_strdup("");
+ } else {
+ in_file_string = input_file_description(in_filename);
+ in_frame_string = g_strdup_printf(" %u of %s", framenum,
+ in_file_string);
+ g_free(in_file_string);
+ }
/* Get a string that describes what we're writing to */
out_file_string = output_file_description(out_filename);
@@ -308,8 +316,8 @@ cfile_write_failure_message(const char *progname, const char *in_filename,
* and the file type and subtype we're writing; note that,
* and report the frame number and file type/subtype.
*/
- cmdarg_err("Frame %u of %s has a network type that can't be saved in a \"%s\" file.",
- framenum, in_file_string,
+ cmdarg_err("Frame%s has a network type that can't be saved in a \"%s\" file.",
+ in_frame_string,
wtap_file_type_subtype_short_string(file_type_subtype));
break;
@@ -319,8 +327,8 @@ cfile_write_failure_message(const char *progname, const char *in_filename,
* and the file type and subtype we're writing; note that,
* and report the frame number and file type/subtype.
*/
- cmdarg_err("Frame %u of %s is larger than %s supports in a \"%s\" file.",
- framenum, in_file_string, progname,
+ cmdarg_err("Frame%s is larger than %s supports in a \"%s\" file.",
+ in_frame_string, progname,
wtap_file_type_subtype_short_string(file_type_subtype));
break;
@@ -330,8 +338,8 @@ cfile_write_failure_message(const char *progname, const char *in_filename,
* and the file type and subtype we're writing; note that,
* and report the record number and file type/subtype.
*/
- cmdarg_err("Record %u of %s has a record type that can't be saved in a \"%s\" file.",
- framenum, in_file_string,
+ cmdarg_err("Record%s has a record type that can't be saved in a \"%s\" file.",
+ in_frame_string,
wtap_file_type_subtype_short_string(file_type_subtype));
break;
@@ -341,9 +349,9 @@ cfile_write_failure_message(const char *progname, const char *in_filename,
* and the file type and subtype we're writing; note that,
* and report the record number and file type/subtype.
*/
- cmdarg_err("Record %u of %s has data that can't be saved in a \"%s\" file.\n"
+ cmdarg_err("Record%s has data that can't be saved in a \"%s\" file.\n"
"(%s)",
- framenum, in_file_string,
+ in_frame_string,
wtap_file_type_subtype_short_string(file_type_subtype),
err_info != NULL ? err_info : "no information supplied");
g_free(err_info);
@@ -373,7 +381,7 @@ cfile_write_failure_message(const char *progname, const char *in_filename,
out_file_string, wtap_strerror(err));
break;
}
- g_free(in_file_string);
+ g_free(in_frame_string);
g_free(out_file_string);
}