diff options
author | Roman Kalashnikov <lunix0x@gmail.com> | 2017-10-28 20:31:39 +0300 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2017-12-22 11:34:12 -0800 |
commit | 4d9fc6264366f971a7382e7b5bb91c46c440c0f1 (patch) | |
tree | cf84d4df1ff6c9d330158a3c56d6f8a43e7f43b8 /libusb | |
parent | b4c9b4272d61cecffeddeb91abd31efe256a6224 (diff) | |
download | libusb-4d9fc6264366f971a7382e7b5bb91c46c440c0f1.tar.gz |
linux_usbfs: Fixed excessive check
Closes #358
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb')
-rw-r--r-- | libusb/os/linux_usbfs.c | 8 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index 98cce75..9486d66 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -1716,10 +1716,7 @@ static int detach_kernel_driver_and_claim(struct libusb_device_handle *handle, strcpy(dc.driver, "usbfs"); dc.flags = USBFS_DISCONNECT_CLAIM_EXCEPT_DRIVER; r = ioctl(fd, IOCTL_USBFS_DISCONNECT_CLAIM, &dc); - if (r == 0 || (r != 0 && errno != ENOTTY)) { - if (r == 0) - return 0; - + if (r != 0 && errno != ENOTTY) { switch (errno) { case EBUSY: return LIBUSB_ERROR_BUSY; @@ -1731,7 +1728,8 @@ static int detach_kernel_driver_and_claim(struct libusb_device_handle *handle, usbi_err(HANDLE_CTX(handle), "disconnect-and-claim failed errno %d", errno); return LIBUSB_ERROR_OTHER; - } + } else if (r == 0) + return 0; /* Fallback code for kernels which don't support the disconnect-and-claim ioctl */ diff --git a/libusb/version_nano.h b/libusb/version_nano.h index d7e79b6..129f818 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11217 +#define LIBUSB_NANO 11218 |