]> err.no Git - yubikey-personalization/commitdiff
return error when libusb_init fails
authorKlas Lindfors <klas@yubico.com>
Fri, 14 Sep 2012 07:23:06 +0000 (09:23 +0200)
committerKlas Lindfors <klas@yubico.com>
Fri, 14 Sep 2012 07:23:06 +0000 (09:23 +0200)
ykcore/ykcore_libusb-1.0.c

index d1d71057e948c52331dc3ff4ce122b34e692fc58..8dbb985e080c0c0ee25b05c3f91102449fcf9c51 100644 (file)
@@ -135,7 +135,11 @@ int _ykusb_read(void *dev, int report_type, int report_number,
 
 int _ykusb_start(void)
 {
-       libusb_init(NULL);
+       ykl_errno = libusb_init(NULL);
+       if(ykl_errno) {
+               yk_errno = YK_EUSBERR;
+               return ykl_errno;
+       }
        libusb_inited = 1;
        return 1;
 }