From 1015fa04313893ba81bca678534fad7a4630d6c8 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 18 Apr 2017 14:02:18 -0700 Subject: Have a common "capture file close alert box" routine. Take cf_close_failure_alert_box() and put it into libui, with the name cfile_close_failure_alert_box(). Use it not only in file.c but also in ui/export_pdu_ui_utils.c, ui/gtk/file_import_dlg.c, and ui/qt/import_text_dialog.cpp where the error we get back isn't necessarily an errno. Have ui/gtk/file_import_dlg.c and ui/qt/import_text_dialog.cpp also use cfile_open_failure_alert_box() on open errors. Change-Id: I987f339a23ea58609390306a319923e7f92d5c07 Reviewed-on: https://code.wireshark.org/review/21203 Reviewed-by: Guy Harris --- ui/alert_box.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'ui/alert_box.h') diff --git a/ui/alert_box.h b/ui/alert_box.h index 9e19234e20..9b2588164a 100644 --- a/ui/alert_box.h +++ b/ui/alert_box.h @@ -52,6 +52,35 @@ extern void cfile_open_failure_alert_box(const char *filename, int err, gchar *err_info, gboolean for_writing, int file_type); +/* + * Alert box for a failed attempt to close a capture file. + * "err" is assumed to be a UNIX-style errno or a WTAP_ERR_ value; + * "err_info" is assumed to be a string giving further information for + * some WTAP_ERR_ values; "for_writing" is TRUE if the file is being + * opened for writing and FALSE if it's being opened for reading; + * "file_type" is a WTAP_FILE_TYPE_SUBTYPE_ value for the type of + * file being written (it's ignored for opening-for-reading errors). + * + * When closing a capture file: + * + * some information in the file that can't be determined until + * all packets have been written might be written to the file + * (such as a table of the file offsets of all packets); + * + * data buffered in the low-level file writing code might be + * flushed to the file; + * + * for remote file systems, data written to the file but not + * yet sent to the server might be sent to the server or, if + * that data was sent asynchronously, "out of space", "disk + * quota exceeded", or "I/O error" indications might have + * been received but not yet delivered, and the close operation + * could deliver them; + * + * so we have to check for write errors here. + */ +extern void cfile_close_failure_alert_box(const char *filename, int err); + /* * Alert box for a failed attempt to open or create a file. * "err" is assumed to be a UNIX-style errno; "for_writing" is TRUE if -- cgit v1.2.1