Module: xenomai-forge
Branch: master
Commit: 5e111e31802df56ea44f3f249a215540f34ef2f0
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=5e111e31802df56ea44f3f249a215540f34ef2f0

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Oct 23 12:25:38 2013 +0200

copperplate/notify: fix error propagation from notifier_init()

---

 lib/copperplate/notifier.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/copperplate/notifier.c b/lib/copperplate/notifier.c
index 0ba4737..99bb8b6 100644
--- a/lib/copperplate/notifier.c
+++ b/lib/copperplate/notifier.c
@@ -141,18 +141,18 @@ int notifier_init(struct notifier *nf,
 {
        pthread_mutexattr_t mattr;
        sigset_t oset;
-       int fd;
+       int fd, ret;
 
        if (pipe(nf->psfd) < 0) {
-               warning("failed to create file descriptors");
-               return __bt(-errno);
+               ret = -errno;
+               goto fail;
        }
 
        if (pipe(nf->pwfd) < 0) {
-               warning("failed to create file descriptors");
+               ret = -errno;
                __STD(close(nf->psfd[0]));
                __STD(close(nf->psfd[1]));
-               return __bt(-errno);
+               goto fail;
        }
 
        nf->callback = callback;
@@ -190,6 +190,10 @@ int notifier_init(struct notifier *nf,
        fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
 
        return 0;
+fail:
+       warning("failed to create notifier pipe");
+
+       return __bt(ret);
 }
 
 void notifier_destroy(struct notifier *nf)


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

Reply via email to