[Pkg-gnupg-commit] [gnupg2] 28/166: scd: Fix cancel INTERRUPT transfer.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Mar 16 22:33:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 216afba0d99582d0fbae1d6e925f4ddb349d9de3
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Mon Jan 30 08:19:32 2017 +0900

    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 at fsij.org>
---
 scd/ccid-driver.c | 29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)

diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index bbdd697..305c9d2 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -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);
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list