From 1d10872062828aede81c775bf19023f3ca8f85fa Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 14 Nov 2012 08:49:57 +0100 Subject: make sure inaccessible config file is not tried to be processed The processing loop was not terminated when an unaccessible file was detected, and so processing was done using unitialized data, which could lead to all sorts of problems. Also did some minor cleanup. --- grammar/rainerscript.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'grammar/rainerscript.c') diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index e54c9060..27ff5376 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -2777,6 +2777,7 @@ cnfDoInclude(char *name) finalName = nameBuf; } } + /* Use GLOB_MARK to append a trailing slash for directories. */ /* Use GLOB_NOMAGIC to detect wildcards that match nothing. */ result = glob(finalName, GLOB_MARK | GLOB_NOMAGIC, NULL, &cfgFiles); @@ -2796,13 +2797,12 @@ cnfDoInclude(char *name) for(i = 0; i < cfgFiles.gl_pathc; i++) { cfgFile = cfgFiles.gl_pathv[i]; - - if(stat(cfgFile, &fileInfo) != 0) - { + if(stat(cfgFile, &fileInfo) != 0) { char errStr[1024]; rs_strerror_r(errno, errStr, sizeof(errStr)); parser_errmsg("error accessing config file or directory '%s': %s", cfgFile, errStr); + continue; } if(S_ISREG(fileInfo.st_mode)) { /* config file */ -- cgit v1.2.3