aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-01-01 13:44:07 -0800
committerGuy Harris <guy@alum.mit.edu>2019-01-01 22:08:59 +0000
commitbe55c4f976249815a797875eefa655d035d1f628 (patch)
treeb2c4e758359fc0e88a5baebf7d8ab0d0f1f5a256 /ui
parente12270a730a60636ad36c06957b7e1f687c562a7 (diff)
Always report errors in eo_save_entry().
If a particular save failed, always let the user know. Change-Id: I618e0ff82813cd4249ab7b1714f9a50e095a1ea8 Reviewed-on: https://code.wireshark.org/review/31296 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r--ui/cli/tap-exportobject.c2
-rw-r--r--ui/export_object_ui.c11
-rw-r--r--ui/export_object_ui.h2
-rw-r--r--ui/qt/models/export_objects_model.cpp4
4 files changed, 8 insertions, 11 deletions
diff --git a/ui/cli/tap-exportobject.c b/ui/cli/tap-exportobject.c
index 0766da779b..316dd03c70 100644
--- a/ui/cli/tap-exportobject.c
+++ b/ui/cli/tap-exportobject.c
@@ -140,7 +140,7 @@ eo_draw(void *tapdata)
g_string_free(safe_filename, TRUE);
} while (g_file_test(save_as_fullpath, G_FILE_TEST_EXISTS) && ++count < 1000);
count = 0;
- if (!eo_save_entry(save_as_fullpath, entry, TRUE))
+ if (!eo_save_entry(save_as_fullpath, entry))
all_saved = FALSE;
g_free(save_as_fullpath);
save_as_fullpath = NULL;
diff --git a/ui/export_object_ui.c b/ui/export_object_ui.c
index ef350d3164..91735c24a1 100644
--- a/ui/export_object_ui.c
+++ b/ui/export_object_ui.c
@@ -28,7 +28,7 @@
#include "export_object_ui.h"
gboolean
-eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry, gboolean show_err)
+eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry)
{
int to_fd;
gint64 bytes_left;
@@ -40,8 +40,7 @@ eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry, gbool
to_fd = ws_open(save_as_filename, O_WRONLY | O_CREAT | O_EXCL |
O_BINARY, 0644);
if(to_fd == -1) { /* An error occurred */
- if (show_err)
- report_open_failure(save_as_filename, errno, TRUE);
+ report_open_failure(save_as_filename, errno, TRUE);
return FALSE;
}
@@ -71,8 +70,7 @@ eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry, gbool
err = errno;
else
err = WTAP_ERR_SHORT_WRITE;
- if (show_err)
- report_write_failure(save_as_filename, err);
+ report_write_failure(save_as_filename, err);
ws_close(to_fd);
return FALSE;
}
@@ -80,8 +78,7 @@ eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry, gbool
ptr += bytes_written;
}
if (ws_close(to_fd) < 0) {
- if (show_err)
- report_write_failure(save_as_filename, errno);
+ report_write_failure(save_as_filename, errno);
return FALSE;
}
diff --git a/ui/export_object_ui.h b/ui/export_object_ui.h
index d0a80a11f1..14d5e513f9 100644
--- a/ui/export_object_ui.h
+++ b/ui/export_object_ui.h
@@ -20,7 +20,7 @@ extern "C" {
/* Common between protocols */
-gboolean eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry, gboolean show_err);
+gboolean eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry);
#ifdef __cplusplus
}
diff --git a/ui/qt/models/export_objects_model.cpp b/ui/qt/models/export_objects_model.cpp
index a1d96b6624..0977a217ee 100644
--- a/ui/qt/models/export_objects_model.cpp
+++ b/ui/qt/models/export_objects_model.cpp
@@ -146,7 +146,7 @@ bool ExportObjectModel::saveEntry(QModelIndex &index, QString filename)
return false;
if (filename.length() > 0) {
- eo_save_entry(filename.toUtf8().constData(), entry, TRUE);
+ eo_save_entry(filename.toUtf8().constData(), entry);
}
return true;
@@ -190,7 +190,7 @@ bool ExportObjectModel::saveAllEntries(QString path)
safe_filename->str, NULL);
g_string_free(safe_filename, TRUE);
} while (g_file_test(save_as_fullpath, G_FILE_TEST_EXISTS) && ++count < 1000);
- if (!eo_save_entry(save_as_fullpath, entry, FALSE))
+ if (!eo_save_entry(save_as_fullpath, entry))
all_saved = false;
g_free(save_as_fullpath);
save_as_fullpath = NULL;