summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-15 16:46:35 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-15 16:49:08 +0100
commitbb27ff6672573727488b5b4826e27ac9cb8a2c94 (patch)
treeebdbd4990dbb146cc5ef86364b564e40484911dd
parent66e411811b8090d1bfd6620fc84472d83f723fa1 (diff)
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.
-rw-r--r--src/login/logind.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/login/logind.c b/src/login/logind.c
index bb34a7f362..f72aac5e61 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();