[Pcsclite-cvs-commit] r2952 - /trunk/PCSC/src/eventhandler.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue May 13 09:09:05 UTC 2008


Author: rousseau
Date: Tue May 13 09:09:05 2008
New Revision: 2952

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=2952
Log:
EHDestroyEventHandler(): log the error message of SYS_ThreadJoin() and
SYS_ThreadCreate() if any

Modified:
    trunk/PCSC/src/eventhandler.c

Modified: trunk/PCSC/src/eventhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/eventhandler.c?rev=2952&op=diff
==============================================================================
--- trunk/PCSC/src/eventhandler.c (original)
+++ trunk/PCSC/src/eventhandler.c Tue May 13 09:09:05 2008
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2000
  *  David Corcoran <corcoran at linuxnet.com>
- * Copyright (C) 2004
+ * Copyright (C) 2004-2008
  *  Ludovic Rousseau <ludovic.rousseau at free.fr>
  *
  * $Id$
@@ -100,6 +100,8 @@
 
 LONG EHDestroyEventHandler(PREADER_CONTEXT rContext)
 {
+	int rv;
+
 	if (NULL == rContext->readerState)
 	{
 		Log1(PCSC_LOG_ERROR, "Thread never started (reader init failed?)");
@@ -123,7 +125,9 @@
 	SYS_ThreadCancel(rContext->pthThread);
 
 	/* wait for the thread to finish */
-	SYS_ThreadJoin(rContext->pthThread, NULL);
+	rv = SYS_ThreadJoin(rContext->pthThread, NULL);
+	if (rv)
+		Log2(PCSC_LOG_ERROR, "SYS_ThreadJoin failed: %s", strerror(rv));
 
 	/*
 	 * Zero out the public status struct to allow it to be recycled and
@@ -191,10 +195,13 @@
 	rContext->pthCardEvent = card_event;
 	rv = SYS_ThreadCreate(&rContext->pthThread, 0,
 		(PCSCLITE_THREAD_FUNCTION( ))EHStatusHandlerThread, (LPVOID) rContext);
-	if (rv == 1)
+	if (rv)
+	{
+		Log2(PCSC_LOG_ERROR, "SYS_ThreadCreate failed: %s", strerror(rv));
+		return SCARD_E_NO_MEMORY;
+	}
+	else
 		return SCARD_S_SUCCESS;
-	else
-		return SCARD_E_NO_MEMORY;
 }
 
 static void incrementEventCounter(struct pubReaderStatesList *readerState)




More information about the Pcsclite-cvs-commit mailing list