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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Apr 22 13:18:57 UTC 2010


Author: rousseau
Date: Thu Apr 22 13:18:41 2010
New Revision: 4888

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4888
Log:
SCardEstablishContext(): call waitpid() to avoid having a defunct pcscd
process when pcscd is auto started by the client.

The process becomes defunct because pcscd calls daemon() and daemon()
does fork() and exit() in the father. The father death must then be
reclaimed by libpcsclite.

Thanks to Patrice Angelini for the bug report

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=4888&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Thu Apr 22 13:18:41 2010
@@ -86,6 +86,7 @@
 #include <stddef.h>
 #include <sys/time.h>
 #include <pthread.h>
+#include <sys/wait.h>
 
 #include "misc.h"
 #include "pcscd.h"
@@ -441,6 +442,10 @@
 
 			/* father process */
 			daemon_launched = TRUE;
+
+			if (waitpid(pid, NULL, 0) < 0)
+				Log2(PCSC_LOG_CRITICAL, "waitpid failed: %s", strerror(errno));
+
 			goto again;
 		}
 	}




More information about the Pcsclite-cvs-commit mailing list