summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-07-29 14:55:44 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-07-29 14:55:44 +0200
commitc3c385c63b627d559bdd7a7a710c543e9c16a20a (patch)
tree53819fdce1c8cb525c0562993020a8db3cc9e588 /runtime
parentd2feb7063e73938c05b76862ea2e211cc09b30fe (diff)
downloadrsyslog-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')
-rw-r--r--runtime/conf.c12
-rw-r--r--runtime/rsyslog.h1
2 files changed, 11 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];
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index 61d81f90..f75a5663 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -250,6 +250,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_GSS_ERR = -2101, /**< generic error occured in GSSAPI subsystem */
RS_RET_CERTLESS = -2102, /**< state: we run without machine cert (this may be OK) */
RS_RET_NO_ACTIONS = -2103, /**< no active actions are configured (no output will be created) */
+ RS_RET_CONF_FILE_NOT_FOUND = -2104, /**< config file or directory not found */
/* RainerScript error messages (range 1000.. 1999) */
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */