summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--grammar/rainerscript.c11
-rwxr-xr-xtests/incltest_dir_empty_wildcard.sh13
-rw-r--r--tests/testsuites/incltest_dir_empty_wildcard.conf11
3 files changed, 31 insertions, 4 deletions
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 1116c913..0dc505a7 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -2770,6 +2770,7 @@ cnfDoInclude(char *name)
glob_t cfgFiles;
struct stat fileInfo;
char nameBuf[MAXFNAME+1];
+ char cwdBuf[MAXFNAME+1];
finalName = name;
if(stat(name, &fileInfo) == 0) {
@@ -2793,8 +2794,9 @@ cnfDoInclude(char *name)
if(result == GLOB_NOSPACE || result == GLOB_ABORTED) {
char errStr[1024];
rs_strerror_r(errno, errStr, sizeof(errStr));
- parser_errmsg("error accessing config file or directory '%s': %s",
- finalName, errStr);
+ getcwd(cwdBuf, sizeof(cwdBuf));
+ parser_errmsg("error accessing config file or directory '%s' [cwd:%s]: %s",
+ finalName, cwdBuf, errStr);
return 1;
}
@@ -2803,8 +2805,9 @@ cnfDoInclude(char *name)
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);
+ getcwd(cwdBuf, sizeof(cwdBuf));
+ parser_errmsg("error accessing config file or directory '%s' "
+ "[cwd: %s]: %s", cfgFile, cwdBuf, errStr);
return 1;
}
diff --git a/tests/incltest_dir_empty_wildcard.sh b/tests/incltest_dir_empty_wildcard.sh
new file mode 100755
index 00000000..6cdb3b21
--- /dev/null
+++ b/tests/incltest_dir_empty_wildcard.sh
@@ -0,0 +1,13 @@
+# This test checks if an empty includeConfig directory causes problems. It
+# should not, as this is a valid situation that by default exists on many
+# distros.
+echo ===============================================================================
+echo \[incltest_dir_empty_wildcard.sh\]: test $IncludeConfig for \"empty\" wildcard
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup incltest_dir_empty_wildcard.conf
+# 100 messages are enough - the question is if the include is read ;)
+source $srcdir/diag.sh injectmsg 0 100
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 99
+source $srcdir/diag.sh exit
diff --git a/tests/testsuites/incltest_dir_empty_wildcard.conf b/tests/testsuites/incltest_dir_empty_wildcard.conf
new file mode 100644
index 00000000..5e750c5b
--- /dev/null
+++ b/tests/testsuites/incltest_dir_empty_wildcard.conf
@@ -0,0 +1,11 @@
+# see .sh file for description
+# rgerhards, 2009-11-30
+$IncludeConfig diag-common.conf
+
+# the following include leads to no files actually being included
+# but MUST NOT abort rsyslog's startup sequence. No files matching
+# the wildcard is valid (as long as the path exists)!
+$IncludeConfig testsuites/incltest.d/*.conf-not-there
+
+$template outfmt,"%msg:F,58:2%\n"
+:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt