]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - src/sem.c
Check for EOF while reading the HTTP request.
[tlsproxy/tlsproxy.git] / src / sem.c
index c18445361fb1fcccd6233a2c98460232d84457ae..ee03e0b1d0872392d3770851e5bcdd372d49750e 100644 (file)
--- a/src/sem.c
+++ b/src/sem.c
@@ -19,8 +19,8 @@
 
 #include "sem.h"
 
-#include <stdlib.h>
 #include <pthread.h>
+#include <stdlib.h>
 
 
 struct SEM {
@@ -69,7 +69,7 @@ int sem_del(SEM *sem) {
 
 void P(SEM *sem) {
     pthread_mutex_lock(&sem->mutex);
-    while (sem->value == 0) {
+    while (sem->value <= 0) {
         pthread_cond_wait(&sem->condition, &sem->mutex);
     }
     sem->value--;