linux: Fixup init_count tracking on hotplug init error
authorHans de Goede <hdegoede@redhat.com>
Thu, 16 May 2013 19:31:31 +0000 (21:31 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 16 May 2013 19:54:22 +0000 (21:54 +0200)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
libusb/os/linux_usbfs.c
libusb/version_nano.h

index 794b3a73539c23cc38f6e99a9198db057f380b6b..cdafb7b89ec89dc6504a3e8c29dbff994dd1dc10 100644 (file)
@@ -436,15 +436,18 @@ static int op_init(struct libusb_context *ctx)
 
        usbi_mutex_static_lock(&hotplug_lock);
        r = LIBUSB_SUCCESS;
-       if (!init_count++) {
+       if (init_count == 0) {
                /* start up hotplug event handler */
                r = linux_start_event_monitor();
-               if (LIBUSB_SUCCESS != r) {
-                       usbi_err(ctx, "error starting hotplug event monitor");
-               }
        }
-       if (r == LIBUSB_SUCCESS)
+       if (r == LIBUSB_SUCCESS) {
                r = linux_scan_devices(ctx);
+               if (r == LIBUSB_SUCCESS)
+                       init_count++;
+               else
+                       linux_stop_event_monitor();
+       } else
+               usbi_err(ctx, "error starting hotplug event monitor");
        usbi_mutex_static_unlock(&hotplug_lock);
 
        return r;
index 7391d652dffc09788c99e2c4bf68e9f563df1240..3db6b73a3fd4607539512242545bd37c58c234a0 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10688
+#define LIBUSB_NANO 10689