[Pcsclite-cvs-commit] r5400 - in /trunk/PCSC/src: eventhandler.c readerfactory.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Nov 16 10:32:45 UTC 2010


Author: rousseau
Date: Tue Nov 16 10:32:45 2010
New Revision: 5400

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5400
Log:
Move the zeroing of the reader context from EHDestroyEventHandler() to
RFUnInitializeReader() where it is more appropriate.

The reader context shall be valid until the reader is uninitialized in
RFUnInitializeReader() and most importantly after IFDCloseIFD() is called.

Modified:
    trunk/PCSC/src/eventhandler.c
    trunk/PCSC/src/readerfactory.c

Modified: trunk/PCSC/src/eventhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/eventhandler.c?rev=5400&op=diff
==============================================================================
--- trunk/PCSC/src/eventhandler.c (original)
+++ trunk/PCSC/src/eventhandler.c Tue Nov 16 10:32:45 2010
@@ -182,19 +182,6 @@
 	rv = pthread_join(rContext->pthThread, NULL);
 	if (rv)
 		Log2(PCSC_LOG_ERROR, "pthread_join failed: %s", strerror(rv));
-
-	/*
-	 * Zero out the public status struct to allow it to be recycled and
-	 * used again
-	 */
-	memset(rContext->readerState->readerName, 0,
-		sizeof(rContext->readerState->readerName));
-	memset(rContext->readerState->cardAtr, 0,
-		sizeof(rContext->readerState->cardAtr));
-	rContext->readerState->readerState = 0;
-	rContext->readerState->readerSharing = 0;
-	rContext->readerState->cardAtrLength = READER_NOT_INITIALIZED;
-	rContext->readerState->cardProtocol = SCARD_PROTOCOL_UNDEFINED;
 
 	/* Zero the thread */
 	rContext->pthThread = 0;

Modified: trunk/PCSC/src/readerfactory.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.c?rev=5400&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.c (original)
+++ trunk/PCSC/src/readerfactory.c Tue Nov 16 10:32:45 2010
@@ -988,6 +988,19 @@
 
 	(void)RFUnBindFunctions(rContext);
 	(void)RFUnloadReader(rContext);
+
+	/*
+	 * Zero out the public status struct to allow it to be recycled and
+	 * used again
+	 */
+	memset(rContext->readerState->readerName, 0,
+		sizeof(rContext->readerState->readerName));
+	memset(rContext->readerState->cardAtr, 0,
+		sizeof(rContext->readerState->cardAtr));
+	rContext->readerState->readerState = 0;
+	rContext->readerState->readerSharing = 0;
+	rContext->readerState->cardAtrLength = READER_NOT_INITIALIZED;
+	rContext->readerState->cardProtocol = SCARD_PROTOCOL_UNDEFINED;
 
 	return SCARD_S_SUCCESS;
 }




More information about the Pcsclite-cvs-commit mailing list