Module: xenomai-3
Branch: master
Commit: 676724f562389e458b46a03316e2c3c4744c8c1c
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=676724f562389e458b46a03316e2c3c4744c8c1c

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Fri Mar 13 19:24:33 2015 +0100

alchemy/sem: Fix nwaiters reported by rt_sem_inquire

If the semaphore value is positive, there are no waiters.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 lib/alchemy/sem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/alchemy/sem.c b/lib/alchemy/sem.c
index b0ce742..cf4add9 100644
--- a/lib/alchemy/sem.c
+++ b/lib/alchemy/sem.c
@@ -490,7 +490,7 @@ int rt_sem_inquire(RT_SEM *sem, RT_SEM_INFO *info)
                goto out;
 
        info->count = sval < 0 ? 0 : sval;
-       info->nwaiters = -sval;
+       info->nwaiters = sval < 0 ? -sval : 0;
        strcpy(info->name, scb->name); /* <= racy. */
 out:
        CANCEL_RESTORE(svc);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to