diff options
author | Andre Lorbach <alorbach@adiscon.com> | 2011-08-18 15:45:00 +0200 |
---|---|---|
committer | Andre Lorbach <alorbach@adiscon.com> | 2011-08-18 15:45:00 +0200 |
commit | c1108d7af1ca04b2c485bd87a8cbbf044ffde6fb (patch) | |
tree | bc313aaed75f9ac30098309ffd07fb5d72869910 /runtime/msg.c | |
parent | 1eff0e2ebee9b6a53a6b77cdc106bbf3b5d62b55 (diff) | |
parent | 154747929f87010b444af2d552f980daafe451e6 (diff) | |
download | rsyslog-c1108d7af1ca04b2c485bd87a8cbbf044ffde6fb.tar.gz rsyslog-c1108d7af1ca04b2c485bd87a8cbbf044ffde6fb.tar.xz rsyslog-c1108d7af1ca04b2c485bd87a8cbbf044ffde6fb.zip |
Merge branch 'v5-stable' into beta
Conflicts:
ChangeLog
configure.ac
Diffstat (limited to 'runtime/msg.c')
-rw-r--r-- | runtime/msg.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 98eb4b89..7b9b9b90 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1673,6 +1673,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; @@ -1691,6 +1693,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); } @@ -1709,8 +1713,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), "-")) { @@ -1720,7 +1727,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); } } @@ -1746,6 +1753,7 @@ getTAG(msg_t *pM, uchar **ppBuf, int *piLen) *piLen = pM->iLenTAG; } } +dbgprintf("getTAG: len %d, buf '%s'\n", *piLen, *ppBuf); } |