From 163a0e6097b68f2699931a87c49b1c6a8903606e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 3 Dec 2023 21:41:55 +0900 Subject: [PATCH] journald: close runtime journals before their parent directory removed No functional change, just for safety. --- src/journal/journald-server.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index f2f52203677..d7c8095d795 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1353,13 +1353,16 @@ finish: if (s->system_journal) journal_file_post_change(s->system_journal); + /* First, close all runtime journals opened in the above. */ + sd_journal_close(j); + + /* Offline and close the 'main' runtime journal file. */ s->runtime_journal = journal_file_offline_close(s->runtime_journal); + /* Remove the runtime directory if the all entries are successfully flushed to /var/. */ if (r >= 0) (void) rm_rf(s->runtime_storage.path, REMOVE_ROOT); - sd_journal_close(j); - server_driver_message(s, 0, NULL, LOG_MESSAGE("Time spent on flushing to %s is %s for %u entries.", s->system_storage.path, -- 2.47.3