From: Yu Watanabe Date: Tue, 16 May 2023 21:02:00 +0000 (+0900) Subject: sd-journal: fix assignment of tail entry offset X-Git-Tag: v254-rc1~307 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45a6a2aace8315137b648193a8265997b3c267fb;p=thirdparty%2Fsystemd.git sd-journal: fix assignment of tail entry offset Fixes a bug introduced by 206f0f397edf1144c63a158fb30f496c3e89f256. --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 78dc9351616..d1f8ca381eb 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 */