summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-07-14 16:06:06 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-07-14 16:06:06 +0200
commitc179a9c5c2dcc7d9ee3f58a027e48624d56a0d0d (patch)
tree93ad057d2204f6f341ab2955733e1ec622ded801
parent816fda97750454bba0845a83d1a2b1ddcabe85e4 (diff)
downloadrsyslog-c179a9c5c2dcc7d9ee3f58a027e48624d56a0d0d.tar.gz
rsyslog-c179a9c5c2dcc7d9ee3f58a027e48624d56a0d0d.tar.xz
rsyslog-c179a9c5c2dcc7d9ee3f58a027e48624d56a0d0d.zip
bugfix: priority was incorrectly calculated on FreeBSD 7
because the LOG_MAKEPRI() C macro has a different meaning there (it is just a simple addition of faciltity and severity). I have changed this to use own, consistent, code for PRI calculation. [Backport from 3.19.10]
-rw-r--r--ChangeLog5
-rw-r--r--msg.c16
2 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index d611d684..5e8619d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,11 @@ Version 3.18.1 (rgerhards), 2008-07-??
unlikely to happen after a successful startup (the only window of
exposure may be a relatively seldom executed action running in queued
mode). This has been corrected. Thank to HKS for point out the problem.
+- bugfix: priority was incorrectly calculated on FreeBSD 7,
+ because the LOG_MAKEPRI() C macro has a different meaning there (it
+ is just a simple addition of faciltity and severity). I have changed
+ this to use own, consistent, code for PRI calculation. [Backport from
+ 3.19.10]
---------------------------------------------------------------------------
Version 3.18.0 (rgerhards), 2008-07-11
- begun a new v3-stable based on former 3.17.4 beta plus patches to
diff --git a/msg.c b/msg.c
index 5258b6eb..1590a7bb 100644
--- a/msg.c
+++ b/msg.c
@@ -673,19 +673,23 @@ char *getMSG(msg_t *pM)
/* Get PRI value in text form */
char *getPRI(msg_t *pM)
{
+ int pri;
+
if(pM == NULL)
return "";
MsgLock(pM);
if(pM->pszPRI == NULL) {
- /* OK, we need to construct it...
- * we use a 5 byte buffer - as of
- * RFC 3164, it can't be longer. Should it
- * still be, snprintf will truncate...
+ /* OK, we need to construct it... we use a 5 byte buffer - as of
+ * RFC 3164, it can't be longer. Should it still be, snprintf will truncate...
+ * Note that we do not use the LOG_MAKEPRI macro. This macro
+ * is a simple add of the two values under FreeBSD 7. So we implement
+ * the logic in our own code. This is a change from a bug
+ * report. -- rgerhards, 2008-07-14
*/
+ pri = pM->iFacility * 8 + pM->iSeverity;
if((pM->pszPRI = malloc(5)) == NULL) return "";
- pM->iLenPRI = snprintf((char*)pM->pszPRI, 5, "%d",
- LOG_MAKEPRI(pM->iFacility, pM->iSeverity));
+ pM->iLenPRI = snprintf((char*)pM->pszPRI, 5, "%d", pri);
}
MsgUnlock(pM);