summaryrefslogtreecommitdiffstats
path: root/runtime/msg.c
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2011-08-18 15:46:33 +0200
committerAndre Lorbach <alorbach@adiscon.com>2011-08-18 15:46:33 +0200
commite14d353e69a75290c3e4004df79f42a22bfe4cab (patch)
tree7d74717632ca25ea585aa30df87d43c1e2f4af3d /runtime/msg.c
parent179a27d80d6c13625d5f9cee9b15acbd5fb33651 (diff)
parentc1108d7af1ca04b2c485bd87a8cbbf044ffde6fb (diff)
downloadrsyslog-e14d353e69a75290c3e4004df79f42a22bfe4cab.tar.gz
rsyslog-e14d353e69a75290c3e4004df79f42a22bfe4cab.tar.bz2
rsyslog-e14d353e69a75290c3e4004df79f42a22bfe4cab.zip
Merge branch 'beta'
Conflicts: runtime/queue.c
Diffstat (limited to 'runtime/msg.c')
-rw-r--r--runtime/msg.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 3bc6ffe6..420fa542 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1653,6 +1653,8 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf)
uchar *pBuf;
assert(pMsg != NULL);
+dbgprintf("MsgSetTAG in: len %d, pszBuf: %s\n", lenBuf, pszBuf);
+
freeTAG(pMsg);
pMsg->iLenTAG = lenBuf;
@@ -1671,6 +1673,8 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf)
memcpy(pBuf, pszBuf, pMsg->iLenTAG);
pBuf[pMsg->iLenTAG] = '\0'; /* this also works with truncation! */
+
+dbgprintf("MsgSetTAG exit: pMsg->iLenTAG %d, pMsg->TAG.szBuf: %s\n", pMsg->iLenTAG, pMsg->TAG.szBuf);
}
@@ -1689,8 +1693,11 @@ static inline void tryEmulateTAG(msg_t *pM, sbool bLockMutex)
if(bLockMutex == LOCK_MUTEX)
MsgLock(pM);
- if(pM->iLenTAG > 0)
+ if(pM->iLenTAG > 0) {
+ if(bLockMutex == LOCK_MUTEX)
+ MsgUnlock(pM);
return; /* done, no need to emulate */
+ }
if(getProtocolVersion(pM) == 1) {
if(!strcmp(getPROCID(pM, MUTEX_ALREADY_LOCKED), "-")) {
@@ -1700,7 +1707,7 @@ static inline void tryEmulateTAG(msg_t *pM, sbool bLockMutex)
/* now we can try to emulate */
lenTAG = snprintf((char*)bufTAG, CONF_TAG_MAXSIZE, "%s[%s]",
getAPPNAME(pM, MUTEX_ALREADY_LOCKED), getPROCID(pM, MUTEX_ALREADY_LOCKED));
- bufTAG[32] = '\0'; /* just to make sure... */
+ bufTAG[sizeof(bufTAG)-1] = '\0'; /* just to make sure... */
MsgSetTAG(pM, bufTAG, lenTAG);
}
}
@@ -1726,6 +1733,7 @@ getTAG(msg_t *pM, uchar **ppBuf, int *piLen)
*piLen = pM->iLenTAG;
}
}
+dbgprintf("getTAG: len %d, buf '%s'\n", *piLen, *ppBuf);
}