fence_virtd: Fix potential unlocked pthread_cond_timedwait()

Fix a potential call to pthread_cond_timedwait() with an unlocked
mutex in the non-blocking syslog wrapper code.

Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
This commit is contained in:
Ryan McCabe 2017-05-26 14:39:38 -04:00
parent 853937d1bd
commit cf48854295

View File

@ -43,13 +43,13 @@ _log_thread(void *arg)
struct timespec ts;
struct log_entry *entry;
pthread_mutex_lock(&log_mutex);
do {
gettimeofday(&tv, NULL);
ts.tv_sec = tv.tv_sec + 10;
ts.tv_nsec = tv.tv_usec;
pthread_mutex_lock(&log_mutex);
while (!(entry = _log_entries)) {
if (pthread_cond_timedwait(&log_cond,
&log_mutex,