[Pcsclite-cvs-commit] r2281 - trunk/PCSC/src

Ludovic Rousseau rousseau at alioth.debian.org
Mon Dec 25 22:41:51 CET 2006


Author: rousseau
Date: 2006-12-25 22:41:51 +0100 (Mon, 25 Dec 2006)
New Revision: 2281

Modified:
   trunk/PCSC/src/readerfactory.c
Log:
RFSetReaderName(): fails if the number of readers exceeds the number of
supported readers by the driver.

If the driver does not implement TAG_IFD_SIMULTANEOUS_ACCESS it is
assumed to only support 1 reader.


Modified: trunk/PCSC/src/readerfactory.c
===================================================================
--- trunk/PCSC/src/readerfactory.c	2006-12-25 20:54:20 UTC (rev 2280)
+++ trunk/PCSC/src/readerfactory.c	2006-12-25 21:41:51 UTC (rev 2281)
@@ -586,7 +586,7 @@
 							"Support %d simultaneous readers", tagValue[0]);
 					}
 					else
-						supportedChannels = -1;
+						supportedChannels = 1;
 
 					/*
 					 * Check to see if it is a hotplug reader and
@@ -637,8 +637,19 @@
 				break;
 		}
 
-		if ((i == PCSCLITE_MAX_READERS_CONTEXTS) || (i > supportedChannels))
-			return -1;
+		if (i == PCSCLITE_MAX_READERS_CONTEXTS)
+		{
+			Log2(PCSC_LOG_ERROR, "Max number of readers reached: %d", PCSCLITE_MAX_READERS_CONTEXTS);
+			return -2;
+		}
+
+		if (i >= supportedChannels)
+		{
+			Log3(PCSC_LOG_ERROR, "Driver %s does not support more than "
+				"%d reader(s). Maybe the driver should support "
+				"TAG_IFD_SIMULTANEOUS_ACCESS", libraryName, supportedChannels);
+			return -2;
+		}
 	}
 
 	sprintf(rContext->lpcReader, "%s %02X %02lX", readerName, i, dwSlot);




More information about the Pcsclite-cvs-commit mailing list