[Pcsclite-cvs-commit] r6104 - /trunk/PCSC/src/winscard_clnt.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Fri Nov 11 15:46:38 UTC 2011
Author: rousseau
Date: Fri Nov 11 15:46:37 2011
New Revision: 6104
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6104
Log:
Do not try to autostart if the system was booted using systemd
The --disable-autostart configure option should now be useless on
systems using systemd.
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=6104&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Fri Nov 11 15:46:37 2011
@@ -392,6 +392,26 @@
static LONG SCardEstablishContextTH(DWORD, LPCVOID, LPCVOID,
/*@out@*/ LPSCARDCONTEXT);
+static int sd_booted(void) {
+#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
+ return 0;
+#else
+
+ struct stat a, b;
+
+ /* We simply test whether the systemd cgroup hierarchy is
+ * mounted */
+
+ if (lstat("/sys/fs/cgroup", &a) < 0)
+ return 0;
+
+ if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
+ return 0;
+
+ return a.st_dev != b.st_dev;
+#endif
+}
+
/**
* @brief Creates an Application Context to the PC/SC Resource Manager.
*
@@ -457,7 +477,7 @@
rv = SCardCheckDaemonAvailability();
#ifdef ENABLE_AUTOSTART
- if (SCARD_E_NO_SERVICE == rv)
+ if (!sd_booted() && SCARD_E_NO_SERVICE == rv)
{
launch:
if (daemon_launched)
More information about the Pcsclite-cvs-commit
mailing list