aboutsummaryrefslogtreecommitdiffstats
path: root/epan/diam_dict.l
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-10-10 19:06:34 +0000
committerGuy Harris <guy@alum.mit.edu>2012-10-10 19:06:34 +0000
commit2ea9adc0de37dac24226ae8a5451b6dd1d583c01 (patch)
treec60a439596ff9402e66adb95d8a01dea71a63d2d /epan/diam_dict.l
parentf68020f1e160200583881aa79e312fe8a8b93e0d (diff)
In the include processing code, if ddict_open() fails, bail out
*regardless* of whether errno is non-zero, so we at least report the failure. In the standalone test program built if TEST_DIAM_DICT_STANDALONE is defined, check for ddict_scan() failing. Part of fix for bug 7824. svn path=/trunk/; revision=45452
Diffstat (limited to 'epan/diam_dict.l')
-rw-r--r--epan/diam_dict.l11
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/diam_dict.l b/epan/diam_dict.l
index b2773da87b..7874112428 100644
--- a/epan/diam_dict.l
+++ b/epan/diam_dict.l
@@ -272,10 +272,11 @@ description_attr description=\042
yyin = ddict_open(sys_dir,e->file);
D(("entity: %s filename: %s yyin: %p\n",e->name,e->file,yyin));
if (!yyin) {
- if (errno) {
+ if (errno)
fprintf(stderr, "Could not open file: '%s', error: %s\n", e->file, g_strerror(errno) );
- yyterminate();
- }
+ else
+ fprintf(stderr, "Could not open file: '%s', error unknown (errno == 0)\n", e->file );
+ yyterminate();
} else {
include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE ) );
@@ -814,6 +815,10 @@ int main(int argc, char** argv) {
}
d = ddict_scan(dname,fname,1);
+ if (d == NULL) {
+ fprintf(stderr, "Can't open dictionary\n");
+ return 2;
+ }
ddict_print(stdout, d);