From a520f022d241fc7ecb0da7181789dded9ec215dc Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 28 Mar 2008 12:58:59 +0000 Subject: prevented potential flood of error messages if regexp lib could not be loaded --- template.c | 8 ++++++-- 1 file 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; } -- cgit