From 45a6a2aace8315137b648193a8265997b3c267fb Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 17 May 2023 06:02:00 +0900 Subject: [PATCH] sd-journal: fix assignment of tail entry offset Fixes a bug introduced by 206f0f397edf1144c63a158fb30f496c3e89f256. --- src/libsystemd/sd-journal/journal-file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 78dc935161..d1f8ca381e 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -2122,7 +2122,8 @@ static int journal_file_link_entry( f->header->tail_entry_realtime = o->entry.realtime; f->header->tail_entry_monotonic = o->entry.monotonic; - f->header->tail_entry_offset = offset; + if (JOURNAL_HEADER_CONTAINS(f->header, tail_entry_offset)) + f->header->tail_entry_offset = htole64(offset); f->newest_mtime = 0; /* we have a new tail entry now, explicitly invalidate newest boot id/timestamp info */ /* Link up the items */