summaryrefslogtreecommitdiffstats
path: root/runtime
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
parent179a27d80d6c13625d5f9cee9b15acbd5fb33651 (diff)
parentc1108d7af1ca04b2c485bd87a8cbbf044ffde6fb (diff)
downloadrsyslog-e14d353e69a75290c3e4004df79f42a22bfe4cab.tar.gz
rsyslog-e14d353e69a75290c3e4004df79f42a22bfe4cab.tar.xz
rsyslog-e14d353e69a75290c3e4004df79f42a22bfe4cab.zip
Merge branch 'beta'
Conflicts: runtime/queue.c
Diffstat (limited to 'runtime')
-rw-r--r--runtime/msg.c12
-rw-r--r--runtime/queue.c9
2 files changed, 18 insertions, 3 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);
}
diff --git a/runtime/queue.c b/runtime/queue.c
index f390d987..3876ec39 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -93,7 +93,6 @@ static rsRetVal qDestructDisk(qqueue_t *pThis);
#define QUEUE_CHECKPOINT 1
#define QUEUE_NO_CHECKPOINT 0
-
/* tables for interfacing with the v6 config system */
static struct cnfparamdescr cnfpdescr[] = {
{ "queue.filename", eCmdHdlrGetWord, 0 },
@@ -127,6 +126,14 @@ static struct cnfparamblk pblk =
cnfpdescr
};
+/* debug aid */
+static void displayBatchState(batch_t *pBatch)
+{
+ int i;
+ for(i = 0 ; i < pBatch->nElem ; ++i) {
+ dbgprintf("XXXXX: displayBatchState %p[%d]: %d\n", pBatch, i, pBatch->pElem[i].state);
+ }
+}
/***********************************************************************
* we need a private data structure, the "to-delete" list. As C does