naccyde / rpms / systemd

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