diff options
author | Frederik Carlier | 2021-01-20 10:39:35 +0100 |
---|---|---|
committer | Frederik Carlier | 2021-01-20 10:39:35 +0100 |
commit | b1a7c7ebf110aece7175b0c4d032608a00a7b55b (patch) | |
tree | 0d017369ccf31d220b177d0665b65584bc5d2564 /src | |
parent | 1248a070f872e15a15b348150ff8bfb96491ddc3 (diff) | |
download | usbmuxd-b1a7c7ebf110aece7175b0c4d032608a00a7b55b.tar.gz usbmuxd-b1a7c7ebf110aece7175b0c4d032608a00a7b55b.tar.bz2 |
Don't call libusb_set_option if libusb_init fails
Diffstat (limited to 'src')
-rw-r--r-- | src/usb.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -827,17 +827,17 @@ int usb_init(void) device_polling = 1; res = libusb_init(NULL); + if (res != 0) { + usbmuxd_log(LL_FATAL, "libusb_init failed: %s", libusb_error_name(res)); + return -1; + } + #if LIBUSB_API_VERSION >= 0x01000106 libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, (log_level >= LL_DEBUG ? LIBUSB_LOG_LEVEL_DEBUG: (log_level >= LL_WARNING ? LIBUSB_LOG_LEVEL_WARNING: LIBUSB_LOG_LEVEL_NONE))); #else libusb_set_debug(NULL, (log_level >= LL_DEBUG ? LIBUSB_LOG_LEVEL_DEBUG: (log_level >= LL_WARNING ? LIBUSB_LOG_LEVEL_WARNING: LIBUSB_LOG_LEVEL_NONE))); #endif - if(res != 0) { - usbmuxd_log(LL_FATAL, "libusb_init failed: %s", libusb_error_name(res)); - return -1; - } - collection_init(&device_list); #ifdef HAVE_LIBUSB_HOTPLUG_API |