Magellan Linux

Annotation of /trunk/pcsc-lite/patches/pcsc-lite-1.7.4-systemd-disable-autostart.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1574 - (hide annotations) (download)
Thu Nov 24 21:10:23 2011 UTC (12 years, 6 months ago) by niro
File size: 2776 byte(s)
-fixed patches
1 niro 1574 From c7f825b2c4a5c7d4ac8abe5690737c2c8fffbfcc Mon Sep 17 00:00:00 2001
2     From: Kalev Lember <kalev@smartlink.ee>
3     Date: Fri, 24 Jun 2011 00:46:13 +0300
4     Subject: [PATCH 2/3] Add --disable-autostart option
5 niro 1573
6 niro 1574 This option disables pcscd autostarting code in the libpcsclite library.
7 niro 1573
8 niro 1574 With systemd socket activation in place, pcscd can be started
9     automatically by systemd when a request arrives on the IPC socket. That
10     makes starting the service as a fork from user library unnecessary.
11     ---
12     PCSC/configure.in | 11 +++++++++++
13     PCSC/src/winscard_clnt.c | 6 ++++++
14     2 files changed, 17 insertions(+), 0 deletions(-)
15    
16     diff --git a/PCSC/configure.in b/PCSC/configure.in
17     index 831ee88..97e3360 100644
18     --- a/PCSC/configure.in
19     +++ b/PCSC/configure.in
20     @@ -274,6 +274,16 @@ if test x$use_libusb = xyes; then
21     PCSCLITE_FEATURES="${PCSCLITE_FEATURES} libusb"
22     fi
23    
24     +# --disable-autostart
25     +AC_ARG_ENABLE(autostart,
26     + AC_HELP_STRING([--disable-autostart], [disable pcscd automatic startup]),
27     + [ use_autostart="${enableval}" ], [ use_autostart="yes" ] )
28     +
29     +if test x$use_autostart != xno; then
30     + AC_DEFINE(ENABLE_AUTOSTART, 1, [Enable pcscd automatic startup])
31     + PCSCLITE_FEATURES="${PCSCLITE_FEATURES} autostart"
32     +fi
33     +
34     # --enable-embedded
35     AC_ARG_ENABLE(embedded,
36     AC_HELP_STRING([--enable-embedded], [limit RAM and CPU ressources by disabling features (log)]),
37     @@ -381,6 +391,7 @@ ATR parsing messages: ${debugatr}
38     ipcdir: ${ipcdir}
39     use serial: ${use_serial}
40     use usb: ${use_usb}
41     +use autostart: ${use_autostart}
42    
43     PCSCLITE_FEATURES: ${PCSCLITE_FEATURES}
44    
45     diff --git a/PCSC/src/winscard_clnt.c b/PCSC/src/winscard_clnt.c
46     index 92c8481..982be01 100644
47     --- a/PCSC/src/winscard_clnt.c
48     +++ b/PCSC/src/winscard_clnt.c
49     @@ -444,8 +444,10 @@ LONG SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1,
50     LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
51     {
52     LONG rv;
53     +#ifdef ENABLE_AUTOSTART
54     int daemon_launched = FALSE;
55     int retries = 0;
56     +#endif
57    
58     API_TRACE_IN("%ld, %p, %p", dwScope, pvReserved1, pvReserved2)
59     PROFILE_START
60     @@ -457,6 +459,7 @@ again:
61     /* we reconnected to a daemon or we got called from a forked child */
62     rv = SCardCheckDaemonAvailability();
63    
64     +#ifdef ENABLE_AUTOSTART
65     if (SCARD_E_NO_SERVICE == rv)
66     {
67     launch:
68     @@ -517,6 +520,7 @@ launch:
69     goto again;
70     }
71     }
72     +#endif
73    
74     if (rv != SCARD_S_SUCCESS)
75     goto end;
76     @@ -526,6 +530,7 @@ launch:
77     pvReserved2, phContext);
78     (void)SCardUnlockThread();
79    
80     +#ifdef ENABLE_AUTOSTART
81     /* SCardEstablishContextTH may fail if the previous pcscd crashed
82     * without cleaning /var/run/pcscd/pcscd.comm */
83     if (SCARD_E_NO_SERVICE == rv)
84     @@ -534,6 +539,7 @@ launch:
85     if (retries <= 1)
86     goto launch;
87     }
88     +#endif
89    
90     end:
91     PROFILE_END(rv)
92 niro 1573 --
93     1.7.5.4
94 niro 1574