summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-07-14 15:59:55 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-07-14 15:59:55 +0200
commit27d70409f7175b29452deb3b66c6e34140e20a61 (patch)
tree7ef5473e3de471a110bb173edfb91beccb2104a5 /runtime
parent40a4ddac7a0fc2ff2dcfd584976ea7ce8bdcfc7b (diff)
downloadrsyslog-27d70409f7175b29452deb3b66c6e34140e20a61.tar.gz
rsyslog-27d70409f7175b29452deb3b66c6e34140e20a61.tar.xz
rsyslog-27d70409f7175b29452deb3b66c6e34140e20a61.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.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/msg.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 78ba19bf..a5881f50 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -679,19 +679,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);