File 0006-stream-driver-Fixed-double-mutex-unlock-when-timeout.patch of Package rsyslog.6132

From ed6ebe56fc9b63a9ab516aba221c68fd7677dc60 Mon Sep 17 00:00:00 2001
From: Andre Lorbach <alorbach@adiscon.com>
Date: Mon, 30 Nov 2015 08:11:13 -0800
Subject: [PATCH] stream driver: Fixed double mutex unlock when timeout git in
 asyncWriterThread

Also corrected mutex locking when timeout occurs, and removed never reached
mutex unlock.

closes https://github.com/rsyslog/rsyslog/issues/439
---
 runtime/stream.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/runtime/stream.c b/runtime/stream.c
index 7cca646..a8bf5f5 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -1271,9 +1271,10 @@ asyncWriterThread(void *pPtr)
 			}
 			if(bTimedOut && pThis->iBufPtr > 0) {
 				/* if we timed out, we need to flush pending data */
+				d_pthread_mutex_unlock(&pThis->mut);
 				strmFlushInternal(pThis, 0);
 				bTimedOut = 0;
-				d_pthread_mutex_unlock(&pThis->mut);
+				d_pthread_mutex_lock(&pThis->mut); 
 				continue;
 			}
 			bTimedOut = 0;
@@ -1310,7 +1311,7 @@ asyncWriterThread(void *pPtr)
 				pthread_cond_broadcast(&pThis->isEmpty);
 		}
 	}
-	d_pthread_mutex_unlock(&pThis->mut);
+	/* Not reached */	
 
 finalize_it:
 	ENDfunc
-- 
2.6.6

openSUSE Build Service is sponsored by