summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-07 13:12:15 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-07 13:12:15 +0200
commit9e9322585d632b20d714cdbf37e86be624b60642 (patch)
tree1fe3ba1c28706f9458570e3dc8567e6aade00303 /runtime
parent27deea809d478fb9984000898f92c89e7843ef49 (diff)
downloadrsyslog-9e9322585d632b20d714cdbf37e86be624b60642.tar.gz
rsyslog-9e9322585d632b20d714cdbf37e86be624b60642.tar.xz
rsyslog-9e9322585d632b20d714cdbf37e86be624b60642.zip
bugfix: property msg was lost when working with disk queues
Diffstat (limited to 'runtime')
-rw-r--r--runtime/msg.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 3b421dbe..63ed0083 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -947,7 +947,6 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm)
objSerializeSCALAR(pStrm, iProtocolVersion, SHORT);
objSerializeSCALAR(pStrm, iSeverity, SHORT);
objSerializeSCALAR(pStrm, iFacility, SHORT);
- objSerializeSCALAR(pStrm, offMSG, SHORT);
objSerializeSCALAR(pStrm, msgFlags, INT);
objSerializeSCALAR(pStrm, ttGenTime, INT);
objSerializeSCALAR(pStrm, tRcvdAt, SYSLOGTIME);
@@ -974,6 +973,11 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm)
objSerializePTR(pStrm, pCSPROCID, CSTR);
objSerializePTR(pStrm, pCSMSGID, CSTR);
+ /* offset must be serialized after pszRawMsg, because we need that to obtain the correct
+ * MSG size.
+ */
+ objSerializeSCALAR(pStrm, offMSG, SHORT);
+
CHKiRet(obj.EndSerialize(pStrm));
finalize_it:
@@ -1157,14 +1161,16 @@ int getMSGLen(msg_t *pM)
char *getMSG(msg_t *pM)
{
+ char *ret;
if(pM == NULL)
- return "";
+ ret = "";
else {
if(pM->offMSG == -1)
- return "";
+ ret = "";
else
- return (char*)(pM->pszRawMsg + pM->offMSG);
+ ret = (char*)(pM->pszRawMsg + pM->offMSG);
}
+ return ret;
}
@@ -2287,6 +2293,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
return "**INVALID PROPERTY NAME**";
}
+
/* If we did not receive a template pointer, we are already done... */
if(pTpe == NULL) {
return pRes;
@@ -2925,7 +2932,7 @@ rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp)
} else if(isProp("msgFlags")) {
pThis->msgFlags = pProp->val.num;
} else if(isProp("offMSG")) {
- pThis->offMSG = pProp->val.num;
+ MsgSetMSGoffs(pThis, pProp->val.num);
} else if(isProp("pszRawMsg")) {
MsgSetRawMsg(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr), cstrLen(pProp->val.pStr));
/* enable this, if someone actually uses UxTradMsg, delete after some time has