ryantimwilson / rpms / systemd

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