[Pcsclite-cvs-commit] r6019 - /trunk/PCSC/src/pcscdaemon.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Oct 7 20:38:42 UTC 2011


Author: rousseau
Date: Fri Oct  7 20:38:41 2011
New Revision: 6019

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6019
Log:
main(): move AutoExit fork+exit later in the code

We should be able to return with an error code if something went wrong
in the pcscd initialization so that the client get the error code and do
not wait for 5 seconds.

See Red Hat Bug 653903 - elinks takes 10 seconds to start

Modified:
    trunk/PCSC/src/pcscdaemon.c

Modified: trunk/PCSC/src/pcscdaemon.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/pcscdaemon.c?rev=6019&op=diff
==============================================================================
--- trunk/PCSC/src/pcscdaemon.c (original)
+++ trunk/PCSC/src/pcscdaemon.c Fri Oct  7 20:38:41 2011
@@ -408,24 +408,6 @@
 	 * root ("/") */
 	(void)chdir("/");
 
-	if (AutoExit)
-	{
-		int pid;
-
-		/* create a new session so that Ctrl-C on the application will
-		 * not also quit pcscd */
-		setsid();
-
-		/* fork() so that pcscd always return in --auto-exit mode */
-		pid = fork();
-		if (-1 == pid )
-			Log2(PCSC_LOG_CRITICAL, "fork() failed: %s", strerror(errno));
-
-		if (pid)
-			/* father */
-			return EXIT_SUCCESS;
-	}
-
 	/*
 	 * If this is set to one the user has asked it not to fork
 	 */
@@ -569,6 +551,24 @@
 #endif
 
 	Log1(PCSC_LOG_INFO, "pcsc-lite " VERSION " daemon ready.");
+
+	if (AutoExit)
+	{
+		int pid;
+
+		/* create a new session so that Ctrl-C on the application will
+		 * not also quit pcscd */
+		setsid();
+
+		/* fork() so that pcscd always return in --auto-exit mode */
+		pid = fork();
+		if (-1 == pid )
+			Log2(PCSC_LOG_CRITICAL, "fork() failed: %s", strerror(errno));
+
+		if (pid)
+			/* father */
+			return EXIT_SUCCESS;
+	}
 
 	/*
 	 * post initialistion




More information about the Pcsclite-cvs-commit mailing list