journal-file: refuse writing to journal files where the header size is different...
authorLennart Poettering <lennart@poettering.net>
Tue, 31 Jan 2023 22:00:07 +0000 (23:00 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 1 Feb 2023 08:20:18 +0000 (09:20 +0100)
commit75bf2627b09d3006c62d4a24dd596205dbc93319
treef2e7e3cfd1ca625a509f85515873a6acd76556d1
parent1bb6ba08b128d62acdbbc566d60a054ff5bb9565
journal-file: refuse writing to journal files where the header size is different then expected

We keep adding fields to the header, and it's fine reading files with
different header sizes, as we check via the size if the fields we need
are included. However, let's be stricter when writing journal files than
when reading, and insist that the header structure in the file actually
matches our expectations. Refuse otherwise, so that a new file is
created after rotation that then matches our expectations.

This makes sure that mismatch in header size is treated exactly as
unknown "compatible" flags, which is our other mechanism to allow
extending the journal file format in a non-breaking way.
src/libsystemd/sd-journal/journal-file.c