summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Muck <christian.muck@bmw.de>2012-05-08 10:23:57 +0200
committerChristian Muck <christian.muck@bmw.de>2012-05-08 10:23:57 +0200
commitdbb054f67a542a24b015f5a5f5003befad642dad (patch)
treef049f5e334d8d1263e6eba6acc71f01e2f2f6f75
parentdf121376667964aa081c27bc644af2fe5423abc9 (diff)
downloadDLT-daemon-dbb054f67a542a24b015f5a5f5003befad642dad.tar.gz
[GDLT-3] Fixed missing semaphore around dlt_buffer_push3
Signed-off-by: Christian Muck <christian.muck@bmw.de>
-rw-r--r--src/daemon/dlt-daemon.c2
-rw-r--r--src/daemon/dlt_daemon_common.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 476f442..be0eeb2 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -1855,6 +1855,7 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemo
/* Message was not sent to client, so store it in client ringbuffer */
if (sent==0)
{
+ DLT_DAEMON_SEM_LOCK();
if (dlt_buffer_push3(&(daemon->client_ringbuffer),
daemon_local->msg.headerbuffer+sizeof(DltStorageHeader),daemon_local->msg.headersize-sizeof(DltStorageHeader),
daemon_local->msg.databuffer,daemon_local->msg.datasize,
@@ -1863,6 +1864,7 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemo
{
dlt_log(LOG_ERR,"Storage of message in history buffer failed! Message discarded.\n");
}
+ DLT_DAEMON_SEM_FREE();
}
}
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index 9a2cbea..66e2b20 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -2221,6 +2221,7 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe
}
else
{
+ DLT_DAEMON_SEM_LOCK();
/* Store message in history buffer */
if (dlt_buffer_push3(&(daemon->client_ringbuffer),
msg->headerbuffer+sizeof(DltStorageHeader),msg->headersize-sizeof(DltStorageHeader),
@@ -2228,9 +2229,11 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe
0, 0
)<0)
{
+ DLT_DAEMON_SEM_FREE();
dlt_log(LOG_ERR,"Storage of message in history buffer failed! Message discarded.\n");
return;
}
+ DLT_DAEMON_SEM_FREE();
}
}