Module: xenomai-2.5
Branch: master
Commit: 8bc17b8528c555745cbc8068d2ee386bea800676
URL:    
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=8bc17b8528c555745cbc8068d2ee386bea800676

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Tue Mar  2 15:45:51 2010 +0100

Native: Fix return code of in-kernel rt_cond_wait[_until]

Return the error of the cond wait epilogue only if the prologue did not
fail. Otherwise use the latter.

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

---

 ksrc/skins/native/cond.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ksrc/skins/native/cond.c b/ksrc/skins/native/cond.c
index 1d0d2eb..05a92a3 100644
--- a/ksrc/skins/native/cond.c
+++ b/ksrc/skins/native/cond.c
@@ -467,17 +467,17 @@ static int rt_cond_wait_inner(RT_COND *cond, RT_MUTEX 
*mutex,
                              xntmode_t timeout_mode, RTIME timeout)
 {
        unsigned lockcnt;
-       int err;
+       int err, epilogue_err = 0;
 
        err = rt_cond_wait_prologue(cond, mutex, &lockcnt, 
                                    timeout_mode, timeout);
 
        if(!err || err == -ETIMEDOUT || err == -EINTR)
                do {
-                       err = rt_cond_wait_epilogue(mutex, lockcnt);
-               } while (err == -EINTR);
+                       epilogue_err = rt_cond_wait_epilogue(mutex, lockcnt);
+               } while (epilogue_err == -EINTR);
 
-       return err;
+       return err ? err : epilogue_err;
 }
 /**
  * @fn int rt_cond_wait(RT_COND *cond, RT_MUTEX *mutex, RTIME timeout)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to