1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-02 22:38:02 +02:00

scd: Fix cancel INTERRUPT transfer.

* scd/ccid-driver.c (do_close_reader): Don't lock events, but check the
return value of libusb_cancel_transfer.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2017-01-30 08:19:32 +09:00
parent f3d9b2582b
commit 216afba0d9

View File

@ -2116,33 +2116,24 @@ do_close_reader (ccid_driver_t handle)
{
if (handle->transfer)
{
/* By locking libusb events, make sure handle->transfer is
canceled properly; Don't cancel completed transfer. */
#ifdef USE_NPTH
npth_unprotect ();
#endif
libusb_lock_events (NULL);
#ifdef USE_NPTH
npth_protect ();
#endif
if (!handle->powered_off)
{
libusb_cancel_transfer (handle->transfer);
libusb_unlock_events (NULL);
DEBUGOUT ("libusb_cancel_transfer\n");
while (!handle->powered_off)
{
rc = libusb_cancel_transfer (handle->transfer);
if (rc != LIBUSB_ERROR_NOT_FOUND)
while (!handle->powered_off)
{
DEBUGOUT ("libusb_handle_events_completed\n");
#ifdef USE_NPTH
npth_unprotect ();
npth_unprotect ();
#endif
libusb_handle_events_completed (NULL, &handle->powered_off);
libusb_handle_events_completed (NULL, &handle->powered_off);
#ifdef USE_NPTH
npth_protect ();
npth_protect ();
#endif
}
}
}
else
libusb_unlock_events (NULL);
libusb_free_transfer (handle->transfer);
}