[Pcsclite-cvs-commit] r5931 - in /trunk/PCSC: configure.in src/winscard_clnt.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Sat Sep 3 21:43:28 UTC 2011


Author: rousseau
Date: Sat Sep  3 21:43:28 2011
New Revision: 5931

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5931
Log:
Add --disable-autostart option

This option disables pcscd autostarting code in the libpcsclite library.

With systemd socket activation in place, pcscd can be started
automatically by systemd when a request arrives on the IPC socket. That
makes starting the service as a fork from user library unnecessary.

Thanks to Kalev Lember for the patch
http://archives.neohapsis.com/archives/dev/muscle/2011-q2/0137.html

Modified:
    trunk/PCSC/configure.in
    trunk/PCSC/src/winscard_clnt.c

Modified: trunk/PCSC/configure.in
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/configure.in?rev=5931&op=diff
==============================================================================
--- trunk/PCSC/configure.in (original)
+++ trunk/PCSC/configure.in Sat Sep  3 21:43:28 2011
@@ -274,6 +274,16 @@
 if test x$use_libusb = xyes; then
   AC_DEFINE(HAVE_LIBUSB, 1, [Libusb is available])
   PCSCLITE_FEATURES="${PCSCLITE_FEATURES} libusb"
+fi
+
+# --disable-autostart
+AC_ARG_ENABLE(autostart,
+  AC_HELP_STRING([--disable-autostart], [disable pcscd automatic startup]),
+  [ use_autostart="${enableval}" ], [ use_autostart="yes" ] )
+
+if test x$use_autostart != xno; then
+  AC_DEFINE(ENABLE_AUTOSTART, 1, [Enable pcscd automatic startup])
+  PCSCLITE_FEATURES="${PCSCLITE_FEATURES} autostart"
 fi
 
 # --enable-embedded
@@ -383,6 +393,7 @@
 ipcdir:               ${ipcdir}
 use serial:           ${use_serial}
 use usb:              ${use_usb}
+use autostart:        ${use_autostart}
 
 PCSCLITE_FEATURES:    ${PCSCLITE_FEATURES}
 

Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=5931&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Sat Sep  3 21:43:28 2011
@@ -444,8 +444,10 @@
 	LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
 {
 	LONG rv;
+#ifdef ENABLE_AUTOSTART
 	int daemon_launched = FALSE;
 	int retries = 0;
+#endif
 
 	API_TRACE_IN("%ld, %p, %p", dwScope, pvReserved1, pvReserved2)
 	PROFILE_START
@@ -457,6 +459,7 @@
 		/* we reconnected to a daemon or we got called from a forked child */
 		rv = SCardCheckDaemonAvailability();
 
+#ifdef ENABLE_AUTOSTART
 	if (SCARD_E_NO_SERVICE == rv)
 	{
 launch:
@@ -517,6 +520,7 @@
 			goto again;
 		}
 	}
+#endif
 
 	if (rv != SCARD_S_SUCCESS)
 		goto end;
@@ -526,6 +530,7 @@
 		pvReserved2, phContext);
 	(void)SCardUnlockThread();
 
+#ifdef ENABLE_AUTOSTART
 	/* SCardEstablishContextTH may fail if the previous pcscd crashed
 	 * without cleaning /var/run/pcscd/pcscd.comm */
 	if (SCARD_E_NO_SERVICE == rv)
@@ -534,6 +539,7 @@
 		if (retries <= 1)
 			goto launch;
 	}
+#endif
 
 end:
 	PROFILE_END(rv)




More information about the Pcsclite-cvs-commit mailing list