daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
1ff636
From c9c9111ad96ab8827a8866f80adbacf4f58e055e Mon Sep 17 00:00:00 2001
1ff636
From: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
1ff636
Date: Fri, 3 Jul 2015 11:34:12 +0100
1ff636
Subject: [PATCH] journal: in persistent mode create /var/log/journal, with all
1ff636
 parents.
1ff636
1ff636
systemd-journald races with systemd-tmpfiles-setup, and hence both are
1ff636
started at about the same time. On a bare-bones system (e.g. with
1ff636
empty /var, or even non-existent /var), systemd-tmpfiles will create
1ff636
/var/log. But it can happen too late, that is systemd-journald already
1ff636
attempted to mkdir /var/log/journal, ignoring the error. Thus failing
1ff636
to create /var/log/journal. One option, without modifiying the
1ff636
dependency graph is to create /var/log/journal directory with parents,
1ff636
when persistent storage has been requested.
1ff636
1ff636
(cherry picked from commit ac892057c2ddd8f06323c73ebd80423cc3ec7190)
1ff636
1ff636
Cherry-picked from: ac89205
1ff636
Resolves: #1222517
1ff636
---
1ff636
 src/journal/journald-server.c | 2 +-
1ff636
 1 file changed, 1 insertion(+), 1 deletion(-)
1ff636
1ff636
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
c62b8e
index 04839c950c..d692c06ef7 100644
1ff636
--- a/src/journal/journald-server.c
1ff636
+++ b/src/journal/journald-server.c
1ff636
@@ -942,7 +942,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
1ff636
                  * the machine path */
1ff636
 
1ff636
                 if (s->storage == STORAGE_PERSISTENT)
1ff636
-                        (void) mkdir("/var/log/journal/", 0755);
1ff636
+                        (void) mkdir_p("/var/log/journal/", 0755);
1ff636
 
1ff636
                 fn = strjoina("/var/log/journal/", ids);
1ff636
                 (void) mkdir(fn, 0755);