diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-19 15:06:20 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-19 22:06:59 +0000 |
commit | 9e36106bafc4919a46ea7ae27c43d98815dfe9c9 (patch) | |
tree | 14590fa475e7e5c90747163ccee8aaf746ec5bde /file.c | |
parent | 4362e63dd54d8d35603d81fd2468cfe710b88f3e (diff) | |
download | wireshark-9e36106bafc4919a46ea7ae27c43d98815dfe9c9.tar.gz |
Have a common "capture file write failure alert box" routine.
Take the code from save_record() to pop up an alert box and put it into
libui, with the name cfile_write_failure_alert_box().
While we're at it, clean up some variable names and comments.
Change-Id: If56e649e5afe50e7a20b39720ec96e8fe2983b24
Reviewed-on: https://code.wireshark.org/review/21233
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 65 |
1 files changed, 2 insertions, 63 deletions
@@ -4006,7 +4006,6 @@ save_record(capture_file *cf, frame_data *fdata, struct wtap_pkthdr hdr; int err; gchar *err_info; - gchar *display_basename; const char *pkt_comment; if (fdata->flags.has_user_comment) @@ -4053,68 +4052,8 @@ save_record(capture_file *cf, frame_data *fdata, #endif /* and save the packet */ if (!wtap_dump(args->pdh, &hdr, pd, &err, &err_info)) { - if (err < 0) { - /* Wiretap error. */ - switch (err) { - - case WTAP_ERR_UNWRITABLE_ENCAP: - /* - * This is a problem with the particular frame we're writing and - * the file type and subtype we're writing; note that, and report - * the frame number and file type/subtype. - */ - simple_error_message_box( - "Frame %u has a network type that can't be saved in a \"%s\" file.", - fdata->num, wtap_file_type_subtype_string(args->file_type)); - break; - - case WTAP_ERR_PACKET_TOO_LARGE: - /* - * This is a problem with the particular frame we're writing and - * the file type and subtype we're writing; note that, and report - * the frame number and file type/subtype. - */ - simple_error_message_box( - "Frame %u is larger than Wireshark supports in a \"%s\" file.", - fdata->num, wtap_file_type_subtype_string(args->file_type)); - break; - - case WTAP_ERR_UNWRITABLE_REC_TYPE: - /* - * This is a problem with the particular record we're writing and - * the file type and subtype we're writing; note that, and report - * the record number and file type/subtype. - */ - simple_error_message_box( - "Record %u has a record type that can't be saved in a \"%s\" file.", - fdata->num, wtap_file_type_subtype_string(args->file_type)); - break; - - case WTAP_ERR_UNWRITABLE_REC_DATA: - /* - * This is a problem with the particular frame we're writing and - * the file type and subtype we're writing; note that, and report - * the frame number and file type/subtype. - */ - simple_error_message_box( - "Record %u has data that can't be saved in a \"%s\" file.\n(%s)", - fdata->num, wtap_file_type_subtype_string(args->file_type), - err_info != NULL ? err_info : "no information supplied"); - g_free(err_info); - break; - - default: - display_basename = g_filename_display_basename(args->fname); - simple_error_message_box( - "An error occurred while writing to the file \"%s\": %s.", - display_basename, wtap_strerror(err)); - g_free(display_basename); - break; - } - } else { - /* OS error. */ - write_failure_alert_box(args->fname, err); - } + cfile_write_failure_alert_box(args->fname, err, err_info, fdata->num, + args->file_type); return FALSE; } |