summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--runtime/msg.c7
-rw-r--r--runtime/msg.h1
-rw-r--r--tools/syslogd.c2
4 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index bccb1f89..360a2bdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
---------------------------------------------------------------------------
+Version 3.20.4 [v3-stable] (rgerhards), 2009-02-??
+- bugfix: invalid mutex access in msg.c
+---------------------------------------------------------------------------
Version 3.20.3 [v3-stable] (rgerhards), 2009-01-19
- doc bugfix: v3-compatiblity document had typo in config directive
thanks to Andrej for reporting this
diff --git a/runtime/msg.c b/runtime/msg.c
index c8dbf2c2..064ed44b 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -188,6 +188,7 @@ static void MsgPrepareEnqueueLockingCase(msg_t *pThis)
* rgerhards, 2008-07-14
*/
pthread_mutexattr_destroy(&pThis->mutAttr);
+ pThis->bDoLock = 1;
ENDfunc
}
@@ -197,14 +198,16 @@ static void MsgLockLockingCase(msg_t *pThis)
{
/* DEV debug only! dbgprintf("MsgLock(0x%lx)\n", (unsigned long) pThis); */
assert(pThis != NULL);
- pthread_mutex_lock(&pThis->mut);
+ if(pThis->bDoLock == 1) /* TODO: this is a testing hack, we should find a way with better performance! -- rgerhards, 2009-01-27 */
+ pthread_mutex_lock(&pThis->mut);
}
static void MsgUnlockLockingCase(msg_t *pThis)
{
/* DEV debug only! dbgprintf("MsgUnlock(0x%lx)\n", (unsigned long) pThis); */
assert(pThis != NULL);
- pthread_mutex_unlock(&pThis->mut);
+ if(pThis->bDoLock == 1) /* TODO: this is a testing hack, we should find a way with better performance! -- rgerhards, 2009-01-27 */
+ pthread_mutex_unlock(&pThis->mut);
}
/* delete the mutex object on message destruction (locking case)
diff --git a/runtime/msg.h b/runtime/msg.h
index c428237a..fadbb48a 100644
--- a/runtime/msg.h
+++ b/runtime/msg.h
@@ -51,6 +51,7 @@
struct msg {
BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */
pthread_mutexattr_t mutAttr;
+short bDoLock; /* use the mutex? */
pthread_mutex_t mut;
int iRefCount; /* reference counter (0 = unused) */
short bParseHOSTNAME; /* should the hostname be parsed from the message? */
diff --git a/tools/syslogd.c b/tools/syslogd.c
index b32ce029..2c66daac 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -1607,7 +1607,7 @@ logmsg(msg_t *pMsg, int flags)
assert(pMsg != NULL);
assert(pMsg->pszUxTradMsg != NULL);
msg = (char*) pMsg->pszUxTradMsg;
- dbgprintf("logmsg: flags %x, pri %s, from '%s', msg %s\n", flags, getPRI(pMsg), getRcvFrom(pMsg), msg);
+ dbgprintf("logmsg: flags %x, from '%s', msg %s\n", flags, getRcvFrom(pMsg), msg);
/* rger 2005-11-24 (happy thanksgiving!): we now need to check if we have
* a traditional syslog message or one formatted according to syslog-protocol.