journal: add/use flushed_flag_is_set() helper (#4041)
authorVito Caputo <vcaputo@gnugeneration.com>
Fri, 26 Aug 2016 15:51:13 +0000 (08:51 -0700)
committerLennart Poettering <lennart@poettering.net>
Fri, 26 Aug 2016 15:51:13 +0000 (17:51 +0200)
Minor cleanup suggested by Lennart.

src/journal/journald-server.c

index ca47d64..3507910 100644 (file)
@@ -267,6 +267,10 @@ static int open_journal(
         return r;
 }
 
+static bool flushed_flag_is_set(void) {
+        return (access("/run/systemd/journal/flushed", F_OK) >= 0);
+}
+
 static int system_journal_open(Server *s, bool flush_requested) {
         bool flushed = false;
         const char *fn;
@@ -274,8 +278,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
 
         if (!s->system_journal &&
             (s->storage == STORAGE_PERSISTENT || s->storage == STORAGE_AUTO) &&
-            (flush_requested
-             || (flushed = (access("/run/systemd/journal/flushed", F_OK) >= 0)))) {
+            (flush_requested || (flushed = flushed_flag_is_set()))) {
 
                 /* If in auto mode: first try to create the machine
                  * path, but not the prefix.