chiark / gitweb /
PAM, uaccess: check for logind, not for systemd
[elogind.git] / src / shared / util.h
index 7c3da08dd8856787a8937a882d79aba17e6eae6d..4c4aed583e9afafc159b7da9a4c40eeadb9d1d59 100644 (file)
@@ -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;
+}