diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-11-14 08:49:57 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-11-14 08:49:57 +0100 |
commit | 1d10872062828aede81c775bf19023f3ca8f85fa (patch) | |
tree | 40b9cfb73b74c240d7e51b9e110d24ca37f8397c /grammar/rainerscript.c | |
parent | 0f6300f1e6a038f37c406b2362218ea043def55b (diff) | |
download | rsyslog-1d10872062828aede81c775bf19023f3ca8f85fa.tar.gz rsyslog-1d10872062828aede81c775bf19023f3ca8f85fa.tar.bz2 rsyslog-1d10872062828aede81c775bf19023f3ca8f85fa.zip |
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.
Diffstat (limited to 'grammar/rainerscript.c')
-rw-r--r-- | grammar/rainerscript.c | 6 |
1 files changed, 3 insertions, 3 deletions
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 */ |