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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Jan 25 15:04:21 UTC 2011


Author: rousseau
Date: Tue Jan 25 15:04:14 2011
New Revision: 5545

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5545
Log:
SCardGetStatusChange(): Always exit from the same point so that profiling
does work even in case of error

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=5545&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Tue Jan 25 15:04:14 2011
@@ -1727,7 +1727,10 @@
 
 	if ((rgReaderStates == NULL && cReaders > 0)
 		|| (cReaders > PCSCLITE_MAX_READERS_CONTEXTS))
-		return SCARD_E_INVALID_PARAMETER;
+	{
+		rv = SCARD_E_INVALID_PARAMETER;
+		goto error;
+	}
 
 	/* Check the integrity of the reader states structures */
 	for (j = 0; j < cReaders; j++)
@@ -1746,11 +1749,17 @@
 				nbNonIgnoredReaders--;
 
 		if (0 == nbNonIgnoredReaders)
-			return SCARD_S_SUCCESS;
+		{
+			rv = SCARD_S_SUCCESS;
+			goto error;
+		}
 	}
 	else
+	{
 		/* reader list is empty */
-		return SCARD_S_SUCCESS;
+		rv = SCARD_S_SUCCESS;
+		goto error;
+	}
 
 	CHECK_SAME_PROCESS
 
@@ -1759,7 +1768,10 @@
 	 */
 	currentContextMap = SCardGetContext(hContext);
 	if (NULL == currentContextMap)
-		return SCARD_E_INVALID_HANDLE;
+	{
+		rv = SCARD_E_INVALID_HANDLE;
+		goto error;
+	}
 
 	(void)pthread_mutex_lock(currentContextMap->mMutex);
 
@@ -1769,7 +1781,10 @@
 		/* the context is now invalid
 		 * -> another thread may have called SCardReleaseContext
 		 * -> so the mMutex has been unlocked */
-		return SCARD_E_INVALID_HANDLE;
+	{
+		rv = SCARD_E_INVALID_HANDLE;
+		goto error;
+	}
 
 	/* synchronize reader states with daemon */
 	rv = getReaderStates(currentContextMap);
@@ -2157,6 +2172,7 @@
 
 	(void)pthread_mutex_unlock(currentContextMap->mMutex);
 
+error:
 	PROFILE_END(rv)
 
 	return rv;




More information about the Pcsclite-cvs-commit mailing list