[Pcsclite-cvs-commit] r2747 - /trunk/PCSC/src/hotplug_libusb.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Mon Jan 21 08:36:19 UTC 2008


Author: rousseau
Date: Mon Jan 21 08:36:19 2008
New Revision: 2747

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=2747
Log:
Patch in revision 2743 was wrong. We need to hold the lock before
traversing the reader list

Modified:
    trunk/PCSC/src/hotplug_libusb.c

Modified: trunk/PCSC/src/hotplug_libusb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/hotplug_libusb.c?rev=2747&op=diff
==============================================================================
--- trunk/PCSC/src/hotplug_libusb.c (original)
+++ trunk/PCSC/src/hotplug_libusb.c Mon Jan 21 08:36:19 2008
@@ -479,6 +479,8 @@
 		dev->descriptor.idVendor, dev->descriptor.idProduct, bus_device);
 	deviceName[sizeof(deviceName) -1] = '\0';
 
+	SYS_MutexLock(&usbNotifierMutex);
+
 	/* find a free entry */
 	for (i=0; i<PCSCLITE_MAX_READERS_CONTEXTS; i++)
 	{
@@ -490,10 +492,9 @@
 	{
 		Log2(PCSC_LOG_ERROR,
 			"Not enough reader entries. Already found %d readers", i);
+		SYS_MutexUnLock(&usbNotifierMutex);
 		return 0;
 	}
-
-	SYS_MutexLock(&usbNotifierMutex);
 
 	strncpy(readerTracker[i].bus_device, bus_device,
 		sizeof(readerTracker[i].bus_device));




More information about the Pcsclite-cvs-commit mailing list