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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Mon Nov 8 08:39:03 UTC 2010


Author: rousseau
Date: Mon Nov  8 08:38:58 2010
New Revision: 5384

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5384
Log:
No need to check the server pid anymore. If the server is restarted the
socket communication will fail and an "RPC transport error"
SCARD_F_COMM_ERROR error will be returned 

This check was needed when the readers state was stored in
/var/run/pcscd/pcscd.pub. But that is no more the case. Every command
now uses the client/server Unix socket.

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=5384&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Mon Nov  8 08:38:58 2010
@@ -268,17 +268,6 @@
  */
 static short isExecuted = 0;
 
-
-/**
- * creation time of pcscd PCSCLITE_CSOCK_NAME file
- */
-static time_t daemon_ctime = 0;
-static pid_t daemon_pid = 0;
-/**
- * PID of the client application.
- * Used to detect fork() and disable handles in the child process
- */
-static pid_t client_pid = 0;
 
 /**
  * Ensure that some functions be accessed in thread-safe mode.
@@ -3627,10 +3616,6 @@
 
 	(void)SCardUnlockThread();
 
-	/* reset pcscd status */
-	daemon_ctime = 0;
-	client_pid = 0;
-
 	return SCARD_E_INVALID_HANDLE;
 }
 
@@ -3649,7 +3634,6 @@
 {
 	LONG rv;
 	struct stat statBuffer;
-	int need_restart = 0;
 	char *socketName;
 
 	socketName = getSocketName();
@@ -3662,32 +3646,6 @@
 		return SCARD_E_NO_SERVICE;
 	}
 
-	/* when the _first_ reader is connected the ctime changes
-	 * I don't know why yet */
-	if (daemon_ctime && statBuffer.st_ctime > daemon_ctime)
-	{
-		/* so we also check the daemon pid to be sure it is a new pcscd */
-		if (GetDaemonPid() != daemon_pid)
-		{
-			Log1(PCSC_LOG_INFO, "PCSC restarted");
-			need_restart = 1;
-		}
-	}
-
-	/* after fork() need to restart */
-	if (client_pid && client_pid != getpid())
-	{
-		Log1(PCSC_LOG_INFO, "Client forked");
-		need_restart = 1;
-	}
-
-	if (need_restart)
-		return SCardInvalidateHandles();
-
-	daemon_ctime = statBuffer.st_ctime;
-	daemon_pid = GetDaemonPid();
-	client_pid = getpid();
-
 	return SCARD_S_SUCCESS;
 }
 




More information about the Pcsclite-cvs-commit mailing list