[Pcsclite-git-commit] [pcsc-tools] 22/32: pcsc_scan: stress() returns the first error value

Ludovic Rousseau rousseau at moszumanska.debian.org
Thu May 4 15:44:48 UTC 2017


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository pcsc-tools.

commit 08452ba121ded92d7d38491bf5c7aef0e40f9367
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Sat Apr 8 17:46:44 2017 +0200

    pcsc_scan: stress() returns the first error value
    
    If SCardTransmit() fails the function should return the error.
---
 pcsc_scan.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/pcsc_scan.c b/pcsc_scan.c
index 85b5011..66d6d6c 100644
--- a/pcsc_scan.c
+++ b/pcsc_scan.c
@@ -100,7 +100,7 @@ static void spin_suspend(void)
 
 static LONG stress(LONG hContext, const char *readerName)
 {
-	LONG rv;
+	LONG rv, ret_rv = SCARD_S_SUCCESS;
 	SCARDHANDLE hCard;
 	DWORD dwActiveProtocol;
 	const SCARD_IO_REQUEST *pioSendPci;
@@ -149,7 +149,8 @@ static LONG stress(LONG hContext, const char *readerName)
 			NULL, pbRecvBuffer, &dwRecvLength);
 		if (rv != SCARD_S_SUCCESS)
 		{
-			print_pcsc_error("SCardDisconnect", rv);
+			print_pcsc_error("SCardTransmit", rv);
+			ret_rv = rv;
 			break;
 		}
 	}
@@ -169,9 +170,12 @@ static LONG stress(LONG hContext, const char *readerName)
 
 	rv = SCardDisconnect(hCard, SCARD_LEAVE_CARD);
 	if (rv != SCARD_S_SUCCESS)
+	{
 		print_pcsc_error("SCardDisconnect", rv);
+		ret_rv = rv;
+	}
 
-	return rv;
+	return ret_rv;
 }
 
 int main(int argc, char *argv[])

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/pcsc-tools.git



More information about the Pcsclite-cvs-commit mailing list