summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2011-07-26 12:20:41 +0200
committerAndre Lorbach <alorbach@adiscon.com>2011-07-26 12:20:41 +0200
commita9b0ddd7803f4c32cc0389426318aa22bd34ac06 (patch)
tree8e0d04bfccb5ff87b0a563bad9722fdba755ce27
parentd2b045c5021ab713e482255d0796996637851745 (diff)
downloadrsyslog-a9b0ddd7803f4c32cc0389426318aa22bd34ac06.tar.gz
rsyslog-a9b0ddd7803f4c32cc0389426318aa22bd34ac06.tar.xz
rsyslog-a9b0ddd7803f4c32cc0389426318aa22bd34ac06.zip
Experimentally added mutex lock in getMSGID in order to fix bug 275.
-rw-r--r--runtime/msg.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index d1e67aa2..f5f7fee1 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1629,14 +1629,20 @@ 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);
+ return (char*) rsCStrGetSzStrNoNULL(pM->pCSMSGID);
+ MsgUnlock(pM);
+ }
}
-
/* rgerhards 2009-06-12: set associated ruleset
*/
void MsgSetRuleset(msg_t *pMsg, ruleset_t *pRuleset)