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.
This commit is contained in:
Lennart Poettering
2013-03-15 16:49:08 +01:00
parent 66e411811b
commit bb27ff6672
+10
View File
@@ -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();