summaryrefslogtreecommitdiffstats
path: root/src/journal
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-08-05 07:18:21 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2024-08-05 11:27:20 +0200
commitb55027efe41b266df4c4704e924fff7dfb32ad70 (patch)
treec62a6edc06ee382fd852557085d557215e604c2c /src/journal
parentsleep: add HibernateOnACPower= option (#33846) (diff)
downloadsystemd-b55027efe41b266df4c4704e924fff7dfb32ad70.tar.xz
systemd-b55027efe41b266df4c4704e924fff7dfb32ad70.zip
journal: set flushed flag even if we fail to open runtime journals
As at this stage, a persistent journal file has been already opened, and saved seqnum has been reset, and any later journal entries will be stored to the file. Hence we should not open the runtime journal file by server_system_journal_open() again.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-server.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 57db614691..09b80881b3 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1347,9 +1347,10 @@ int server_flush_to_var(Server *s, bool require_flag_file) {
start = now(CLOCK_MONOTONIC);
r = sd_journal_open(&j, SD_JOURNAL_RUNTIME_ONLY | SD_JOURNAL_ASSUME_IMMUTABLE);
- if (r < 0)
- return log_ratelimit_error_errno(r, JOURNAL_LOG_RATELIMIT,
- "Failed to read runtime journal: %m");
+ if (r < 0) {
+ log_ratelimit_error_errno(r, JOURNAL_LOG_RATELIMIT, "Failed to read runtime journal: %m");
+ goto finish;
+ }
sd_journal_set_data_threshold(j, 0);