diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-07-29 14:55:44 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-07-29 14:55:44 +0200 |
commit | c3c385c63b627d559bdd7a7a710c543e9c16a20a (patch) | |
tree | 53819fdce1c8cb525c0562993020a8db3cc9e588 /runtime/conf.c | |
parent | d2feb7063e73938c05b76862ea2e211cc09b30fe (diff) | |
download | rsyslog-c3c385c63b627d559bdd7a7a710c543e9c16a20a.tar.gz rsyslog-c3c385c63b627d559bdd7a7a710c543e9c16a20a.tar.xz rsyslog-c3c385c63b627d559bdd7a7a710c543e9c16a20a.zip |
added testbed for config errors and fixed a bug
- bugfix: no error was reported if the target of a $IncludeConfig
could not be accessed.
- added testbed for common config errors
Diffstat (limited to 'runtime/conf.c')
-rw-r--r-- | runtime/conf.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/conf.c b/runtime/conf.c index 6a7caa41..ffe67dbe 100644 --- a/runtime/conf.c +++ b/runtime/conf.c @@ -190,6 +190,7 @@ doIncludeLine(uchar **pp, __attribute__((unused)) void* pVal) char pattern[MAXFNAME]; uchar *cfgFile; glob_t cfgFiles; + int result; size_t i = 0; struct stat fileInfo; @@ -197,14 +198,21 @@ doIncludeLine(uchar **pp, __attribute__((unused)) void* pVal) ASSERT(*pp != NULL); if(getSubString(pp, (char*) pattern, sizeof(pattern) / sizeof(char), ' ') != 0) { - errmsg.LogError(0, RS_RET_NOT_FOUND, "could not extract group name"); + errmsg.LogError(0, RS_RET_NOT_FOUND, "could not parse config file name"); ABORT_FINALIZE(RS_RET_NOT_FOUND); } /* Use GLOB_MARK to append a trailing slash for directories. * Required by doIncludeDirectory(). */ - glob(pattern, GLOB_MARK, NULL, &cfgFiles); + result = glob(pattern, GLOB_MARK, NULL, &cfgFiles); + if(result != 0) { + char errStr[1024]; + rs_strerror_r(errno, errStr, sizeof(errStr)); + errmsg.LogError(0, RS_RET_FILE_NOT_FOUND, "error accessing config file or directory '%s': %s", + pattern, errStr); + ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND); + } for(i = 0; i < cfgFiles.gl_pathc; i++) { cfgFile = (uchar*) cfgFiles.gl_pathv[i]; |