From 3a787b5e2954b79f0604063ad9b5a3f4af04f249 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 25 Jan 2022 23:53:58 +0000 Subject: [PATCH] journal: stat journal file after truncating Let's make sure the data stored in last_stat is up-to-date after truncating the journal file. --- src/journal/journald-file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/journal/journald-file.c b/src/journal/journald-file.c index 0e698e329b..9337925ffd 100644 --- a/src/journal/journald-file.c +++ b/src/journal/journald-file.c @@ -31,9 +31,9 @@ static int journald_file_truncate(JournalFile *f) { f->header->arena_size = htole64(p - le64toh(f->header->header_size)); if (ftruncate(f->fd, p) < 0) - log_debug_errno(errno, "Failed to truncate %s: %m", f->path); + return log_debug_errno(errno, "Failed to truncate %s: %m", f->path); - return 0; + return journal_file_fstat(f); } static int journald_file_entry_array_punch_hole(JournalFile *f, uint64_t p, uint64_t n_entries) {