1 # Disable pcscd on-demand startup (#653903)
2 https://bugzilla.redhat.com/show_bug.cgi?id=653903
4 --- pcsc-lite-1.7.0/src/winscard_clnt.c.orig 2011-02-22 23:20:25.000000000 +0100
5 +++ pcsc-lite-1.7.0/src/winscard_clnt.c 2011-03-18 16:44:57.275416294 +0100
7 LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
10 - int daemon_launched = FALSE;
13 API_TRACE_IN("%ld, %p, %p", dwScope, pvReserved1, pvReserved2)
17 /* Check if the server is running */
18 rv = SCardCheckDaemonAvailability();
19 if (SCARD_E_INVALID_HANDLE == rv)
20 /* we reconnected to a daemon or we got called from a forked child */
21 rv = SCardCheckDaemonAvailability();
23 - if (SCARD_E_NO_SERVICE == rv)
26 - if (daemon_launched)
29 - if (retries < 50) /* 50 x 100ms = 5 seconds */
31 - /* give some more time to the server to start */
32 - SYS_USleep(100*1000); /* 100 ms */
36 - /* the server failed to start (in time) */
47 - Log2(PCSC_LOG_CRITICAL, "fork failed: %s", strerror(errno));
48 - rv = SCARD_F_INTERNAL_ERROR;
55 - char *param = getenv("PCSCLITE_PCSCD_ARGS");
57 - /* close all file handles except stdin, stdout and
58 - * stderr so that pcscd does not confiscate ressources
59 - * allocated by the application */
60 - max = sysconf(_SC_OPEN_MAX);
63 - for (i=3; i<max; i++)
67 - execl(PCSCD_BINARY, "pcscd", "--auto-exit", param,
69 - Log2(PCSC_LOG_CRITICAL, "exec " PCSCD_BINARY " failed: %s",
74 - /* father process */
75 - daemon_launched = TRUE;
77 - if (waitpid(pid, NULL, 0) < 0)
78 - Log2(PCSC_LOG_CRITICAL, "waitpid failed: %s", strerror(errno));
84 if (rv != SCARD_S_SUCCESS)
88 pvReserved2, phContext);
89 (void)SCardUnlockThread();
91 - /* SCardEstablishContextTH may fail if the previous pcscd crashed
92 - * without cleaning /var/run/pcscd/pcscd.comm */
93 - if (SCARD_E_NO_SERVICE == rv)
102 API_TRACE_OUT("%ld", *phContext)