diff options
author | Andre Lorbach <alorbach@adiscon.com> | 2011-07-26 12:20:41 +0200 |
---|---|---|
committer | Andre Lorbach <alorbach@adiscon.com> | 2011-07-26 12:20:41 +0200 |
commit | a9b0ddd7803f4c32cc0389426318aa22bd34ac06 (patch) | |
tree | 8e0d04bfccb5ff87b0a563bad9722fdba755ce27 | |
parent | d2b045c5021ab713e482255d0796996637851745 (diff) | |
download | rsyslog-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.c | 12 |
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) |