summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2011-08-10 11:16:31 +0200
committerAndre Lorbach <alorbach@adiscon.com>2011-08-10 11:16:31 +0200
commit2c403b28be8a9925a3289f41287b38866836af61 (patch)
treed8d3d0ddb2f27d9abc0ab931978e5aa36ed3c7d3 /runtime
parentd28f4610657672220999eacd5aa2f5a25d994c42 (diff)
parent37f5a7376a8e259d3ccbd2bd01aac3b2824c4a7e (diff)
downloadrsyslog-2c403b28be8a9925a3289f41287b38866836af61.tar.gz
rsyslog-2c403b28be8a9925a3289f41287b38866836af61.tar.xz
rsyslog-2c403b28be8a9925a3289f41287b38866836af61.zip
Merge branch 'v5-stable-msgidfix' into v5-stable
Diffstat (limited to 'runtime')
-rw-r--r--runtime/msg.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 8c8e9670..cc7b463d 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1629,14 +1629,21 @@ finalize_it:
}
-/* rgerhards, 2005-11-24
+/* al, 2011-07-26: LockMsg to avoid race conditions
*/
static inline char *getMSGID(msg_t *pM)
{
- return (pM->pCSMSGID == NULL) ? "-" : (char*) rsCStrGetSzStrNoNULL(pM->pCSMSGID);
+ if (pM->pCSMSGID == NULL) {
+ return "-";
+ }
+ else {
+ MsgLock(pM);
+ char* pszreturn = (char*) rsCStrGetSzStrNoNULL(pM->pCSMSGID);
+ MsgUnlock(pM);
+ return pszreturn;
+ }
}
-
/* rgerhards 2009-06-12: set associated ruleset
*/
void MsgSetRuleset(msg_t *pMsg, ruleset_t *pRuleset)