summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-04-20 13:25:21 -0700
committerGuy Harris <guy@alum.mit.edu>2017-04-20 20:25:59 +0000
commit64ec2b2e5ed590a6f1a3d22c8b24a6e70420d1f9 (patch)
treeaab752fe44790898535c850d89e015b75b569149 /file.c
parent2e6cb9dbab154531b306e472642ff6033f0e341c (diff)
downloadwireshark-64ec2b2e5ed590a6f1a3d22c8b24a6e70420d1f9.tar.gz
Take the error message generation out of the merge_files routines.
Have them just return the information needed for the caller to produce an error message, and have the callers use the new cfile_ routines for reporting errors. This requires that the "write failure alert box" routine take the *input* file name as an argument, so that, on a merge, if the problem is that a record from a given input file can't be written out to the type of output file we're generating, the input file name can be given, along with the record number in that file. Change-Id: If5a5e00539e7e652008a523dec92c0b359a48e71 Reviewed-on: https://code.wireshark.org/review/21257 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'file.c')
-rw-r--r--file.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/file.c b/file.c
index fe28c9ae2d..a05cd24ac7 100644
--- a/file.c
+++ b/file.c
@@ -1349,6 +1349,7 @@ cf_merge_files_to_tempfile(gpointer pd_window, char **out_filenamep,
int err = 0;
gchar *err_info = NULL;
guint err_fileno;
+ guint32 err_framenum;
merge_result status;
merge_progress_callback_t cb;
callback_data_t *cb_data = g_new0(callback_data_t, 1);
@@ -1366,7 +1367,7 @@ cf_merge_files_to_tempfile(gpointer pd_window, char **out_filenamep,
in_file_count, do_append,
IDB_MERGE_MODE_ALL_SAME, 0 /* snaplen */,
"Wireshark", &cb, &err, &err_info,
- &err_fileno);
+ &err_fileno, &err_framenum);
g_free(cb.data);
@@ -1386,12 +1387,27 @@ cf_merge_files_to_tempfile(gpointer pd_window, char **out_filenamep,
cfile_dump_open_failure_alert_box(*out_filenamep, err, file_type);
break;
- case MERGE_ERR_CANT_READ_INFILE: /* fall through */
+ case MERGE_ERR_CANT_READ_INFILE:
+ cfile_read_failure_alert_box(in_filenames[err_fileno], err, err_info);
+ break;
+
case MERGE_ERR_BAD_PHDR_INTERFACE_ID:
+ simple_error_message_box("Record %u of \"%s\" has an interface ID that does not match any IDB in its file.",
+ err_framenum, in_filenames[err_fileno]);
+ break;
+
case MERGE_ERR_CANT_WRITE_OUTFILE:
+ cfile_write_failure_alert_box(in_filenames[err_fileno],
+ *out_filenamep, err, err_info,
+ err_framenum, file_type);
+ break;
+
case MERGE_ERR_CANT_CLOSE_OUTFILE:
+ cfile_close_failure_alert_box(*out_filenamep, err);
+ break;
+
default:
- simple_error_message_box("%s", err_info ? err_info : "unknown error");
+ simple_error_message_box("Unknown merge_files error %d", status);
break;
}
@@ -4050,7 +4066,7 @@ save_record(capture_file *cf, frame_data *fdata,
#endif
/* and save the packet */
if (!wtap_dump(args->pdh, &hdr, pd, &err, &err_info)) {
- cfile_write_failure_alert_box(args->fname, err, err_info, fdata->num,
+ cfile_write_failure_alert_box(NULL, args->fname, err, err_info, fdata->num,
args->file_type);
return FALSE;
}