aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/hostlist_table.c
diff options
context:
space:
mode:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2009-02-15 15:02:29 +0000
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2009-02-15 15:02:29 +0000
commitca01e447cb1e887c7f8bd69a8a66f6f732730d89 (patch)
treed2fb6769a0f2be77357b1a40c9547263c032d96a /gtk/hostlist_table.c
parent77d6fbef4678811810724a7b9258a8fe8fab2aef (diff)
Compiling on Ubuntu 8.10 gives a warning when not checking the return value
from fwrite, so added a check. Also use size_t for nbytes. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27451 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk/hostlist_table.c')
-rw-r--r--gtk/hostlist_table.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c
index a0f84d9af2..5186e68b03 100644
--- a/gtk/hostlist_table.c
+++ b/gtk/hostlist_table.c
@@ -718,7 +718,7 @@ open_as_map_cb(GtkWindow *copy_bt, gpointer data _U_)
char * dst_file_path;
FILE * src_file;
FILE * dst_file;
- int nbytes;
+ size_t nbytes;
char buf[256];
src_file_path = get_datafile_path("ipmap.html");
@@ -732,7 +732,12 @@ open_as_map_cb(GtkWindow *copy_bt, gpointer data _U_)
do {
nbytes = fread(buf, 1, sizeof(buf)-1, src_file);
- fwrite(buf, 1, nbytes, dst_file);
+ if (fwrite(buf, 1, nbytes, dst_file) != nbytes) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Couldn't write %zu bytes to \"%s\"", nbytes, dst_file_path);
+ fclose(src_file);
+ fclose(dst_file);
+ return;
+ }
} while(nbytes == sizeof(buf)-1);
fclose(src_file);