summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/login/pam-module.c6
-rw-r--r--src/shared/util.h5
-rw-r--r--src/udev/udev-builtin-uaccess.c3
3 files changed, 8 insertions, 6 deletions
diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index 702095e5e6..0d4f7991e7 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -32,8 +32,6 @@
#include <security/pam_ext.h>
#include <security/pam_misc.h>
-#include <systemd/sd-daemon.h>
-
#include "util.h"
#include "audit.h"
#include "macro.h"
@@ -348,8 +346,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
/* pam_syslog(handle, LOG_INFO, "pam-systemd initializing"); */
- /* Make this a NOP on non-systemd systems */
- if (sd_booted() <= 0)
+ /* Make this a NOP on non-logind systems */
+ if (!logind_running())
return PAM_SUCCESS;
if (parse_argv(handle,
diff --git a/src/shared/util.h b/src/shared/util.h
index 7c3da08dd8..4c4aed583e 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -36,6 +36,7 @@
#include <dirent.h>
#include <sys/resource.h>
#include <stddef.h>
+#include <unistd.h>
#include <systemd/sd-journal.h>
#include "macro.h"
@@ -639,3 +640,7 @@ static inline void _reset_umask_(struct umask_struct *s) {
static inline unsigned u64log2(uint64_t n) {
return (n > 1) ? __builtin_clzll(n) ^ 63U : 0;
}
+
+static inline bool logind_running(void) {
+ return access("/run/systemd/seats/", F_OK) >= 0;
+}
diff --git a/src/udev/udev-builtin-uaccess.c b/src/udev/udev-builtin-uaccess.c
index 662bac9e0b..354ee08f28 100644
--- a/src/udev/udev-builtin-uaccess.c
+++ b/src/udev/udev-builtin-uaccess.c
@@ -29,7 +29,6 @@
#include <dirent.h>
#include <getopt.h>
-#include <systemd/sd-daemon.h>
#include <systemd/sd-login.h>
#include "logind-acl.h"
#include "udev.h"
@@ -49,7 +48,7 @@ static int builtin_uaccess(struct udev_device *dev, int argc, char *argv[], bool
umask(0022);
/* don't muck around with ACLs when the system is not running systemd */
- if (!sd_booted())
+ if (!logind_running())
return 0;
path = udev_device_get_devnode(dev);