io: Move timerfd close into error handling path
authorChris Dickens <christopher.a.dickens@gmail.com>
Fri, 29 Aug 2014 23:12:55 +0000 (16:12 -0700)
committerChris Dickens <christopher.a.dickens@gmail.com>
Sun, 7 Sep 2014 06:17:36 +0000 (23:17 -0700)
This makes error handling consistent with other areas. This is a
follow-on change to commit b72f4cf77edb1975cada8aab5ae63361c68c5992.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/io.c
libusb/version_nano.h

index eb6f41b..2bc122c 100644 (file)
@@ -1147,10 +1147,8 @@ int usbi_io_init(struct libusb_context *ctx)
        if (ctx->timerfd >= 0) {
                usbi_dbg("using timerfd for timeouts");
                r = usbi_add_pollfd(ctx, ctx->timerfd, POLLIN);
-               if (r < 0) {
-                       close(ctx->timerfd);
-                       goto err_remove_hp_pipe;
-               }
+               if (r < 0)
+                       goto err_close_timerfd;
        } else {
                usbi_dbg("timerfd not available (code %d error %d)", ctx->timerfd, errno);
                ctx->timerfd = -1;
@@ -1160,7 +1158,8 @@ int usbi_io_init(struct libusb_context *ctx)
        return 0;
 
 #ifdef USBI_TIMERFD_AVAILABLE
-err_remove_hp_pipe:
+err_close_timerfd:
+       close(ctx->timerfd);
        usbi_remove_pollfd(ctx, ctx->hotplug_pipe[0]);
 #endif
 err_close_hp_pipe:
index 6841c9c..4b584fa 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10917
+#define LIBUSB_NANO 10918