anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0517-journal-add-use-flushed_flag_is_set-helper-4041.patch

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