From 6f21a68bee126c3c03412db983387960f0b2671c Mon Sep 17 00:00:00 2001
From: Christos Tsantilas <christos@chtsanti.net>
Date: Fri, 29 Sep 2023 14:01:55 +0300
Subject: [PATCH] Bug fix: InterProcessLockingScheme pthread acts as a fork
bomb
The shared pthread mutexes are not initialised properly causing undefined
behavior to c-icap server.
---
os/unix/proc_mutex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/os/unix/proc_mutex.c b/os/unix/proc_mutex.c
index 035a9d1..bebb68b 100644
--- a/os/unix/proc_mutex.c
+++ b/os/unix/proc_mutex.c
@@ -394,6 +394,7 @@ static int pthread_proc_mutex_init(ci_proc_mutex_t * mutex, const char *name)
assert(pthread);
pthread->mtx_id = mtx_id;
PThreadSharedMemRegistered++;
+ PThreadSharedMemPtr[pthread->mtx_id].state = MTX_STATE_OK;
pmutex_init(&PThreadSharedMemPtr[pthread->mtx_id].mtx);
mutex->data = pthread;
return 1;