aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-10-10 19:50:37 +0000
committerGuy Harris <guy@alum.mit.edu>2012-10-10 19:50:37 +0000
commit5ba1ad12cc92c5d8e87d8ff4edb5767d4cf63d64 (patch)
tree90df7c7f78c2e9609ea4143a80aea06d68a2290a
parent8c2916b5bb898e52feaa3c002675e19efc3722e8 (diff)
Based on patch from Bill Parker, check for ws_fopen() failing.
The rest of the code already checks for namelist being null, so it's OK to call build_tree_view() - and it may be necessary to do so, as the code below might assume that's worked. However, we should not call fclose() on namelist if it's null; the C89 standard, at least, does *not* assert that fclose(NULL) is a no-op. Clean up indentation a little bit. Last part of fix for bug 7824. svn path=/trunk/; revision=45455
-rw-r--r--plugins/asn1/packet-asn1.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/asn1/packet-asn1.c b/plugins/asn1/packet-asn1.c
index b01747eb05..114a79e13a 100644
--- a/plugins/asn1/packet-asn1.c
+++ b/plugins/asn1/packet-asn1.c
@@ -3111,10 +3111,10 @@ static char eol[] = "\r\n";
logf = ws_fopen(asn1_logfile, "w");
}
if (logf) {
- fputs(message, logf);
- fputs(eol, logf);
- fflush(logf); /* debugging ... */
- }
+ fputs(message, logf);
+ fputs(eol, logf);
+ fflush(logf); /* debugging ... */
+ }
}
static void
@@ -4246,9 +4246,13 @@ create_message_window(void)
G_TYPE_STRING, G_TYPE_STRING);
namelist = ws_fopen("namelist.txt", "w");
+ if (!namelist)
+ fprintf(stderr, "unable to open file: namelist.txt for writing!\n");
build_tree_view(model, PDUtree, NULL);
- fclose(namelist);
- namelist = 0;
+ if (namelist) {
+ fclose(namelist);
+ namelist = 0;
+ }
/* create tree view */
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));