From bb27ff6672573727488b5b4826e27ac9cb8a2c94 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 15 Mar 2013 16:46:35 +0100 Subject: [PATCH] logind: explicitly create state directories during early initialization Strictly speaking this isn't necessary for the /run/systemd/seats/ directory, since that is created anyway as the first seat is found, and seat0 is always found. But let's be explicit here, and also create the sessions/ and users/ directories, so that people can always install inotify watches from very early on, even when nobody logged in yet. --- src/login/logind.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/login/logind.c b/src/login/logind.c index bb34a7f36..f72aac5e6 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -37,6 +37,7 @@ #include "dbus-loop.h" #include "strv.h" #include "conf-parser.h" +#include "mkdir.h" Manager *manager_new(void) { Manager *m; @@ -1727,6 +1728,15 @@ int main(int argc, char *argv[]) { goto finish; } + /* Always create the directories people can create inotify + * watches in. Note that some applications might check for the + * existance of /run/systemd/seats/ to determine whether + * logind is available, so please always make sure this check + * stays in. */ + mkdir_label("/run/systemd/seats", 0755); + mkdir_label("/run/systemd/users", 0755); + mkdir_label("/run/systemd/sessions", 0755); + m = manager_new(); if (!m) { r = log_oom(); -- 2.30.2