exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit f2948bd521eff23cc81ea722ae66f7e2635ad2a8
parent b3b45bdb3675034afc7d6e66b7f32354ed99dbd2
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 31 Jan 2026 22:52:14 +0100

fix possible race on socket closing

Diffstat:
Msrc/util/secmod_common.c | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/util/secmod_common.c b/src/util/secmod_common.c @@ -402,6 +402,7 @@ sign_worker (void *cls) break; } } + GNUNET_assert (0 == pthread_mutex_lock (&TES_clients_lock)); GNUNET_break (0 == close (client->csock)); client->csock = -1; #ifdef __linux__ @@ -413,6 +414,7 @@ sign_worker (void *cls) GNUNET_break (0 == close (client->esock_out)); client->esock_out = -1; #endif + GNUNET_assert (0 == pthread_mutex_unlock (&TES_clients_lock)); return NULL; } @@ -523,12 +525,16 @@ listen_job (void *cls) TES_clients_tail, client); GNUNET_assert (0 == pthread_mutex_unlock (&TES_clients_lock)); - GNUNET_break (0 == close (client->csock)); + if (-1 != client->csock) + GNUNET_break (0 == close (client->csock)); #ifdef __linux__ - GNUNET_break (0 == close (client->esock)); + if (-1 != client->esock) + GNUNET_break (0 == close (client->esock)); #else - GNUNET_break (0 == close (client->esock_in)); - GNUNET_break (0 == close (client->esock_out)); + if (-1 != client->esock_in) + GNUNET_break (0 == close (client->esock_in)); + if (-1 != client->esock_out) + GNUNET_break (0 == close (client->esock_out)); #endif GNUNET_free (client); }