summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-28 12:58:59 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-28 12:58:59 +0000
commita520f022d241fc7ecb0da7181789dded9ec215dc (patch)
treea0e70312e709d4f907c042b7fb832e69459bc102
parent419655c5126a48c4f300d0f975c11703c9e75598 (diff)
downloadrsyslog-a520f022d241fc7ecb0da7181789dded9ec215dc.tar.gz
rsyslog-a520f022d241fc7ecb0da7181789dded9ec215dc.tar.xz
rsyslog-a520f022d241fc7ecb0da7181789dded9ec215dc.zip
prevented potential flood of error messages if regexp lib could not be
loaded
-rw-r--r--template.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/template.c b/template.c
index 847b1265..1d0526d6 100644
--- a/template.c
+++ b/template.c
@@ -42,6 +42,7 @@ DEFobjCurrIf(obj)
DEFobjCurrIf(errmsg)
DEFobjCurrIf(regexp)
+static int bFirstRegexpErrmsg = 1; /**< did we already do a "can't load regexp" error message? */
static struct template *tplRoot = NULL; /* the root of the template list */
static struct template *tplLast = NULL; /* points to the last element of the template list */
static struct template *tplLastStatic = NULL; /* last static element of the template list */
@@ -636,8 +637,11 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
/* regexp object could not be loaded */
dbgprintf("error %d trying to load regexp library - this may be desired and thus OK",
iRetLocal);
- errmsg.LogError(NO_ERRCODE, "regexp library could not be loaded (error %d), regexp"
- "ignored", iRetLocal);
+ if(bFirstRegexpErrmsg) { /* prevent flood of messages, maybe even an endless loop! */
+ bFirstRegexpErrmsg = 0;
+ errmsg.LogError(NO_ERRCODE, "regexp library could not be loaded (error %d), "
+ "regexp ignored", iRetLocal);
+ }
pTpe->data.field.has_regex = 2;
}