-------- Original-Nachricht --------
Am 26.04.2013 20:43, schrieb Michael Karcher: > On Fri, Apr 26, 2013 at 08:15:02PM +0200, Thomas Arp wrote: >> here is a small patch fixing a bug in libnetmd. >> libusb_open() function has to be checked for errors before trying to >> call libusb_claim_interface(). > That patch looks quite sensible. I would prefer to not have the > assignment and the comparison in the same line, as this style is not used > anywhere in libnetmd yet. If you send an adjusted patch, I will > immediately commit it. > > Regards, > Michael Karcher O.K., adjusted. Thomas |
>From 77cd1f26609e8681cd7e855e64ed6d4a5e6ecf0a Mon Sep 17 00:00:00 2001 From: Thomas Arp <manner.moe@gmx.de> Date: Fri, 26 Apr 2013 20:56:58 +0200 Subject: [PATCH] Check for error code from libusb_open in netmd_open function --- libnetmd/netmd_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libnetmd/netmd_dev.c b/libnetmd/netmd_dev.c index 263e446..8a5ad8b 100644 --- a/libnetmd/netmd_dev.c +++ b/libnetmd/netmd_dev.c @@ -116,8 +116,9 @@ netmd_error netmd_open(netmd_device *dev, netmd_dev_handle **dev_handle) int result; libusb_device_handle *dh = NULL; - libusb_open(dev->usb_dev, &dh); - result = libusb_claim_interface(dh, 0); + result = libusb_open(dev->usb_dev, &dh); + if (result == 0) + result = libusb_claim_interface(dh, 0); if (result == 0) { *dev_handle = (netmd_dev_handle*)dh; -- 1.8.0.msysgit.0