From 56cd7e2fe3fd32cb212d0e7976a6bae09ff4948c Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 29 Aug 2011 21:16:23 -0400 Subject: [PATCH] Fix range of sem_count Signed-off-by: Mathieu Desnoyers --- libust/lttng-ust-comm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libust/lttng-ust-comm.c b/libust/lttng-ust-comm.c index 9400b6b8..c5a3064a 100644 --- a/libust/lttng-ust-comm.c +++ b/libust/lttng-ust-comm.c @@ -217,6 +217,9 @@ int handle_register_done(struct sock_info *sock_info) if (sock_info->constructor_sem_posted) return 0; sock_info->constructor_sem_posted = 1; + if (uatomic_read(&sem_count) <= 0) { + return 0; + } ret = uatomic_add_return(&sem_count, -1); if (ret == 0) { ret = sem_post(&constructor_wait); -- 2.34.1