[Pcsclite-cvs-commit] r6056 - /trunk/PCSC/src/winscard_clnt.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Oct 20 15:08:55 UTC 2011


Author: rousseau
Date: Thu Oct 20 15:08:55 2011
New Revision: 6056

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6056
Log:
Remove DO_CHECK_SAME_PROCESS code since we now use pthread_atfork()
since revision 6055

Modified:
    trunk/PCSC/src/winscard_clnt.c

Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=6056&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Thu Oct 20 15:08:55 2011
@@ -113,11 +113,6 @@
 /* Profile the execution time of WinSCard calls */
 #undef DO_PROFILE
 
-/* Check that handles are not shared between (forked) processes
- * This check is disabled since some systems uses the same PID for
- * different threads of a same process */
-#undef DO_CHECK_SAME_PROCESS
-
 
 /** used for backward compatibility */
 #define SCARD_PROTOCOL_ANY_OLD	0x1000
@@ -367,17 +362,6 @@
 static void SCardInvalidateHandles(void);
 static LONG SCardGetSetAttrib(SCARDHANDLE hCard, int command, DWORD dwAttrId,
 	LPBYTE pbAttr, LPDWORD pcbAttrLen);
-
-#ifdef DO_CHECK_SAME_PROCESS
-pid_t client_pid = 0;
-static LONG SCardCheckSameProcess(void);
-#define CHECK_SAME_PROCESS \
-	rv = SCardCheckSameProcess(); \
-	if (rv != SCARD_S_SUCCESS) \
-		return rv;
-#else
-#define CHECK_SAME_PROCESS
-#endif
 
 static LONG getReaderStates(SCONTEXTMAP * currentContextMap);
 
@@ -761,8 +745,6 @@
 
 	API_TRACE_IN("%ld", hContext)
 	PROFILE_START
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this context has been opened
@@ -908,8 +890,6 @@
 	 */
 	if (strlen(szReader) > MAX_READERNAME)
 		return SCARD_E_INVALID_VALUE;
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this context has been opened
@@ -1061,8 +1041,6 @@
 	if (pdwActiveProtocol == NULL)
 		return SCARD_E_INVALID_PARAMETER;
 
-	CHECK_SAME_PROCESS
-
 	/*
 	 * Make sure this handle has been opened
 	 */
@@ -1165,8 +1143,6 @@
 
 	PROFILE_START
 	API_TRACE_IN("%ld %ld", hCard, dwDisposition)
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this handle has been opened
@@ -1270,8 +1246,6 @@
 	CHANNEL_MAP * pChannelMap;
 
 	PROFILE_START
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this handle has been opened
@@ -1379,8 +1353,6 @@
 	CHANNEL_MAP * pChannelMap;
 
 	PROFILE_START
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this handle has been opened
@@ -1568,8 +1540,6 @@
 
 	*pcchReaderLen = 0;
 	*pcbAtrLen = 0;
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this handle has been opened
@@ -1873,8 +1843,6 @@
 		rv = SCARD_S_SUCCESS;
 		goto error;
 	}
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this context has been opened
@@ -2390,8 +2358,6 @@
 	/* 0 bytes received by default */
 	if (NULL != lpBytesReturned)
 		*lpBytesReturned = 0;
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this handle has been opened
@@ -2688,8 +2654,6 @@
 	SCONTEXTMAP * currentContextMap;
 	CHANNEL_MAP * pChannelMap;
 
-	CHECK_SAME_PROCESS
-
 	/*
 	 * Make sure this handle has been opened
 	 */
@@ -2838,8 +2802,6 @@
 			pcbRecvLength == NULL || pioSendPci == NULL)
 		return SCARD_E_INVALID_PARAMETER;
 
-	CHECK_SAME_PROCESS
-
 	/*
 	 * Make sure this handle has been opened
 	 */
@@ -3016,8 +2978,6 @@
 	if (pcchReaders == NULL)
 		return SCARD_E_INVALID_PARAMETER;
 
-	CHECK_SAME_PROCESS
-
 	/*
 	 * Make sure this context has been opened
 	 */
@@ -3131,8 +3091,6 @@
 	SCONTEXTMAP * currentContextMap;
 
 	PROFILE_START
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this context has been opened
@@ -3211,8 +3169,6 @@
 	/* Multi-string with two trailing \0 */
 	const char ReaderGroup[] = "SCard$DefaultReaders\0";
 	const unsigned int dwGroups = sizeof(ReaderGroup);
-
-	CHECK_SAME_PROCESS
 
 	/*
 	 * Make sure this context has been opened
@@ -3393,9 +3349,6 @@
 
 	rv = SCARD_S_SUCCESS;
 
-	/* Check if the _same_ server is running */
-	CHECK_SAME_PROCESS
-
 	/*
 	 * Make sure this context has been opened
 	 */
@@ -3747,22 +3700,6 @@
 	(void)SCardUnlockThread();
 }
 
-#ifdef DO_CHECK_SAME_PROCESS
-static LONG SCardCheckSameProcess(void)
-{
-	/* after fork() need to restart */
-	if ((client_pid && client_pid != getpid()))
-	{
-		Log1(PCSC_LOG_INFO, "Client forked");
-		return SCardInvalidateHandles();
-	}
-
-	client_pid = getpid();
-
-	return SCARD_S_SUCCESS;
-}
-#endif
-
 static LONG getReaderStates(SCONTEXTMAP * currentContextMap)
 {
 	int32_t dwClientID = currentContextMap->dwClientID;




More information about the Pcsclite-cvs-commit mailing list