]> err.no Git - yubikey-personalization/commitdiff
fixup EMORETHANONE for windows
authorKlas Lindfors <klas@yubico.com>
Wed, 9 Jan 2013 13:02:55 +0000 (14:02 +0100)
committerKlas Lindfors <klas@yubico.com>
Wed, 9 Jan 2013 13:02:55 +0000 (14:02 +0100)
ykcore/ykcore_windows.c

index 4f437ff93aae4cbf9d2dd99c1bc3d5f4b65cf97f..dafac02ff679f7f0b603e1b542ee2ec3bda9dfba 100644 (file)
@@ -100,7 +100,9 @@ void * _ykusb_open_device(int vendor_id, int *product_ids, size_t pids_len)
                                                                        ret_handle = m_handle;
                                                                        break;
                                                                } else {
-                                                                       rc = YK_EMORETHANONE;
+                                                                       yk_errno = YK_EMORETHANONE;
+                                                                       ret_handle = NULL;
+                                                                       CloseHandle (m_handle);
                                                                        goto done;
                                                                }
                                                        }
@@ -115,6 +117,9 @@ void * _ykusb_open_device(int vendor_id, int *product_ids, size_t pids_len)
 
                free (pi);
        }
+       if(ret_handle != NULL) {
+               goto done;
+       }
 
        yk_errno = YK_ENOKEY;