|
|
17b0f1 |
From 0adc312bbf5ea8ea654a5a4740f78f37eda2e9d3 Mon Sep 17 00:00:00 2001
|
|
|
17b0f1 |
From: Vito Caputo <vcaputo@gnugeneration.com>
|
|
|
17b0f1 |
Date: Thu, 17 Aug 2017 09:45:38 +0200
|
|
|
17b0f1 |
Subject: [PATCH] journal: add/use flushed_flag_is_set() helper (#4041)
|
|
|
17b0f1 |
|
|
|
17b0f1 |
Minor cleanup suggested by Lennart.
|
|
|
17b0f1 |
|
|
|
17b0f1 |
(cherry-picked from commit 6431c7e216ceb9f3cfe073c94a47ac413b892e55)
|
|
|
17b0f1 |
|
|
|
17b0f1 |
Related: #1364092
|
|
|
17b0f1 |
---
|
|
|
17b0f1 |
src/journal/journald-server.c | 6 ++++--
|
|
|
17b0f1 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
17b0f1 |
|
|
|
17b0f1 |
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
|
|
|
17b0f1 |
index 3e9412d577..96ffda4ec9 100644
|
|
|
17b0f1 |
--- a/src/journal/journald-server.c
|
|
|
17b0f1 |
+++ b/src/journal/journald-server.c
|
|
|
17b0f1 |
@@ -917,6 +917,9 @@ finish:
|
|
|
17b0f1 |
dispatch_message_real(s, iovec, n, m, ucred, tv, label, label_len, unit_id, priority, object_pid);
|
|
|
17b0f1 |
}
|
|
|
17b0f1 |
|
|
|
17b0f1 |
+static bool flushed_flag_is_set(void) {
|
|
|
17b0f1 |
+ return (access("/run/systemd/journal/flushed", F_OK) >= 0);
|
|
|
17b0f1 |
+}
|
|
|
17b0f1 |
|
|
|
17b0f1 |
static int system_journal_open(Server *s, bool flush_requested) {
|
|
|
17b0f1 |
int r;
|
|
|
17b0f1 |
@@ -933,8 +936,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
|
|
|
17b0f1 |
|
|
|
17b0f1 |
if (!s->system_journal &&
|
|
|
17b0f1 |
(s->storage == STORAGE_PERSISTENT || s->storage == STORAGE_AUTO) &&
|
|
|
17b0f1 |
- (flush_requested
|
|
|
17b0f1 |
- || (flushed = (access("/run/systemd/journal/flushed", F_OK) >= 0)))) {
|
|
|
17b0f1 |
+ (flush_requested || (flushed = flushed_flag_is_set()))) {
|
|
|
17b0f1 |
|
|
|
17b0f1 |
/* If in auto mode: first try to create the machine
|
|
|
17b0f1 |
* path, but not the prefix.
|