Fix race condition in semaphore_wait (#727856)

Signed-off-by: Adam Tkac <atkac@redhat.com>
This commit is contained in:
Adam Tkac 2011-08-03 15:14:01 +02:00
parent 2979be244b
commit ca3623992d
2 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,15 @@
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);
}

View File

@ -1,6 +1,6 @@
Name: bind-dyndb-ldap
Version: 0.2.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: LDAP back-end plug-in for BIND
Group: System Environment/Libraries
@ -15,6 +15,8 @@ BuildRequires: openldap-devel
Requires: bind >= 32:9.6.1-0.3.b1
Patch0:bind-dyndb-ldap-rh727856.patch
%description
This package provides an LDAP back-end plug-in for BIND. It features
support for dynamic updates and internal caching, to lift the load
@ -23,6 +25,7 @@ off of your LDAP server.
%prep
%setup -q
%patch0 -p1 -b .rh727856
%build
export CFLAGS="`isc-config.sh --cflags dns` $RPM_OPT_FLAGS"
@ -50,6 +53,9 @@ rm -rf %{buildroot}
%changelog
* Wed Aug 03 2011 Adam Tkac <atkac redhat com> - 0.2.0-4
- fix race condition in semaphore_wait (#727856)
* Mon Feb 21 2011 Adam Tkac <atkac redhat com> - 0.2.0-3
- rebuild against new bind