summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2017-01-20 17:14:35 +0100
committerSven Eden <yamakuzure@gmx.net>2017-03-14 10:23:02 +0100
commitc40fa3382a1b90aa5bccf2b36276e717461b11b0 (patch)
treeb9799beef649e57b01cedebad286327b4f7e226a /src
parent1dcc35973e70aa02beb37fcc9d289053c264eef1 (diff)
Create /run/systemd as needed
* src/login/logind.c (main): Also create /run/systemd at startup. * Create /run/systemd/machines, so that the login monitor works. * Fail if any of the needed directories could not be created. * But do not fail if any of the needed directories exist.
Diffstat (limited to 'src')
-rw-r--r--src/login/logind.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/login/logind.c b/src/login/logind.c
index 755d0be21..de6fbfbd4 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -1130,9 +1130,21 @@ int main(int argc, char *argv[]) {
* existence 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);
+ r = mkdir_label("/run/systemd", 0755);
+ if ( (r < 0) && (-EEXIST != r) )
+ return log_error_errno(r, "Failed to create /run/systemd : %m");
+ r = mkdir_label("/run/systemd/seats", 0755);
+ if ( r < 0 && (-EEXIST != r) )
+ return log_error_errno(r, "Failed to create /run/systemd/seats : %m");
+ r = mkdir_label("/run/systemd/users", 0755);
+ if ( r < 0 && (-EEXIST != r) )
+ return log_error_errno(r, "Failed to create /run/systemd/users : %m");
+ r = mkdir_label("/run/systemd/sessions", 0755);
+ if ( r < 0 && (-EEXIST != r) )
+ return log_error_errno(r, "Failed to create /run/systemd/sessions : %m");
+ r = mkdir_label("/run/systemd/machines", 0755);
+ if ( r < 0 && (-EEXIST != r) )
+ return log_error_errno(r, "Failed to create /run/systemd/machines : %m");
m = manager_new();
if (!m) {