summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2011-08-16 11:01:41 +0200
committerAndre Lorbach <alorbach@adiscon.com>2011-08-16 11:01:41 +0200
commit803462104b4eb319c05ea0f6e30c0b04548a1ed0 (patch)
tree994e92fbcb18fa858ac712fd2219cfa57a9e51c7 /runtime
parent1b9a4f303bd3e0cb899788e1a8908ea60e23eadd (diff)
parent33bf53cdab0689bd7f100aca5f09dd6b69da0e94 (diff)
downloadrsyslog-803462104b4eb319c05ea0f6e30c0b04548a1ed0.tar.gz
rsyslog-803462104b4eb319c05ea0f6e30c0b04548a1ed0.tar.xz
rsyslog-803462104b4eb319c05ea0f6e30c0b04548a1ed0.zip
Merge branch 'v5-stable' into v5-devel
Conflicts: ChangeLog configure.ac
Diffstat (limited to 'runtime')
-rw-r--r--runtime/msg.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 9fdaded3..f1de8130 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1661,6 +1661,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;
@@ -1679,6 +1681,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);
}
@@ -1697,8 +1701,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), "-")) {
@@ -1708,7 +1715,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);
}
}
@@ -1734,6 +1741,7 @@ getTAG(msg_t *pM, uchar **ppBuf, int *piLen)
*piLen = pM->iLenTAG;
}
}
+dbgprintf("getTAG: len %d, buf '%s'\n", *piLen, *ppBuf);
}