summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2005-10-05 14:48:35 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2005-10-05 14:48:35 +0000
commit01f0a8a0cdfbee0983cebe53ef2d8432cf2f9d27 (patch)
treed1783183c246e39578750c5fa2dd9a73340a24c5 /syslogd.c
parent35eb0504b505369d10589287554909a208e6386e (diff)
downloadrsyslog-01f0a8a0cdfbee0983cebe53ef2d8432cf2f9d27.tar.gz
rsyslog-01f0a8a0cdfbee0983cebe53ef2d8432cf2f9d27.tar.xz
rsyslog-01f0a8a0cdfbee0983cebe53ef2d8432cf2f9d27.zip
fixed an issue with mysql error handling
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/syslogd.c b/syslogd.c
index 594cbc4b..27bee376 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -5569,14 +5569,19 @@ void DBErrorHandler(register struct filed *f)
*
* Think about diffrent "delay" for diffrent errors!
*/
+ /* Enable "delay" */
+ f->f_timeResumeOnError = time(&f->f_timeResumeOnError) + _DB_DELAYTIMEONERROR ;
+ f->f_iLastDBErrNo = mysql_errno(&f->f_hmysql);
+ /* *NOW* report the error. The order of operations is vitally important.
+ * Previously, we reported before setting the db error suspend, which
+ * lead to an endless loop. So do not do that again ;)
+ * rgerhards, 2005-10-05
+ */
errno = 0;
snprintf(errMsg, sizeof(errMsg)/sizeof(char),
"db error (%d): %s\n", mysql_errno(&f->f_hmysql),
mysql_error(&f->f_hmysql));
logerror(errMsg);
- /* Enable "delay" */
- f->f_timeResumeOnError = time(&f->f_timeResumeOnError) + _DB_DELAYTIMEONERROR ;
- f->f_iLastDBErrNo = mysql_errno(&f->f_hmysql);
}