bind-dyndb-ldap/bind-dyndb-ldap-rh727856.patch
Adam Tkac ca3623992d Fix race condition in semaphore_wait (#727856)
Signed-off-by: Adam Tkac <atkac@redhat.com>
2011-08-03 15:14:01 +02:00

16 lines
477 B
Diff

diff -up bind-dyndb-ldap-0.2.0/src/semaphore.c.rh727856 bind-dyndb-ldap-0.2.0/src/semaphore.c
--- bind-dyndb-ldap-0.2.0/src/semaphore.c.rh727856 2011-08-02 18:03:49.034837252 +0200
+++ bind-dyndb-ldap-0.2.0/src/semaphore.c 2011-08-03 14:44:42.230665446 +0200
@@ -83,9 +83,9 @@ semaphore_wait(semaphore_t *sem)
LOCK(&sem->mutex);
- sem->value--;
- if (sem->value < 0)
+ while (sem->value <= 0)
WAIT(&sem->cond, &sem->mutex);
+ sem->value--;
UNLOCK(&sem->mutex);
}