mirror of
https://github.com/systemd/systemd.git
synced 2026-07-17 04:50:47 +00:00
journalctl: never fail at flushing when the flushed flag is set
Even if journald was not running, flushing the volatile journal used to work if
the journal was already flushed (ie the flushed flag
/run/systemd/journald/flushed was created).
However since commit 4f413af2a0, this behavior changed and now '--flush' fails
because it tries to contact journald without checking the presence of the
flushed flag anymore.
This patch restores the previous behavior since there's no reason to fail when
journalctl can figure out that the flush is not necessary.
This commit is contained in:
committed by
Lennart Poettering
parent
e236711fd7
commit
f6fca35e64
@@ -2064,6 +2064,11 @@ static int simple_varlink_call(const char *option, const char *method) {
|
||||
}
|
||||
|
||||
static int flush_to_var(void) {
|
||||
if (access("/run/systemd/journal/flushed", F_OK) >= 0)
|
||||
return 0; /* Already flushed, no need to contact journald */
|
||||
if (errno != ENOENT)
|
||||
return log_error_errno(errno, "Unable to check for existence of /run/systemd/journal/flushed: %m");
|
||||
|
||||
return simple_varlink_call("--flush", "io.systemd.Journal.FlushToVar");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user