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

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Thu Jul  2 18:16:22 2015 +0200

cobalt/posix/timer: Set error return codes

These error exit paths incorrectly returned the positive timer ID so
far, although the timer is deleted on error.

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

---

 kernel/cobalt/posix/timer.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
index 0adc112..e5551b3 100644
--- a/kernel/cobalt/posix/timer.c
+++ b/kernel/cobalt/posix/timer.c
@@ -163,8 +163,10 @@ static inline int timer_create(clockid_t clockid,
                        signo = 0; /* Don't notify. */
                else {
                        signo = evp->sigev_signo;
-                       if (signo < 1 || signo > _NSIG)
+                       if (signo < 1 || signo > _NSIG) {
+                               ret = -EINVAL;
                                goto fail;
+                       }
                        timer->sigp.si.si_value = evp->sigev_value;
                }
        }
@@ -174,8 +176,10 @@ static inline int timer_create(clockid_t clockid,
        timer->id = timer_id;
 
        target = timer_init(timer, evp);
-       if (target == NULL)
+       if (target == NULL) {
+               ret = -EPERM;
                goto fail;
+       }
 
        if (IS_ERR(target)) {
                ret = PTR_ERR(target);


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

Reply via email to