diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-09-22 19:42:31 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-09-26 06:26:22 +0200 |
commit | b761ae0fca48bbfe755be4f363e210c148b21140 (patch) | |
tree | 0361f961e8de758b122aea50a082b60ff6ab9419 /src | |
parent | sd-journal: also verify tail_entry_boot_id and friends in journal_file_verify... (diff) | |
download | systemd-b761ae0fca48bbfe755be4f363e210c148b21140.tar.xz systemd-b761ae0fca48bbfe755be4f363e210c148b21140.zip |
sd-journal: boot_id is always non-NULL
The two callers of journal_file_append_entry_internal() always pass
non-NULL boot ID.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-journal/journal-file.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 638a6e1f9d..872f16b386 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -2298,6 +2298,7 @@ static int journal_file_append_entry_internal( assert(f); assert(f->header); assert(ts); + assert(boot_id); assert(items || n_items == 0); if (f->strict_order) { @@ -2318,7 +2319,7 @@ static int journal_file_append_entry_internal( "timestamp %" PRIu64 ", refusing entry.", ts->realtime, le64toh(f->header->tail_entry_realtime)); - if ((!boot_id || sd_id128_equal(*boot_id, f->header->tail_entry_boot_id)) && + if (sd_id128_equal(*boot_id, f->header->tail_entry_boot_id) && ts->monotonic < le64toh(f->header->tail_entry_monotonic)) return log_debug_errno( SYNTHETIC_ERRNO(ENOTNAM), @@ -2358,9 +2359,7 @@ static int journal_file_append_entry_internal( o->entry.realtime = htole64(ts->realtime); o->entry.monotonic = htole64(ts->monotonic); o->entry.xor_hash = htole64(xor_hash); - if (boot_id) - f->header->tail_entry_boot_id = *boot_id; - o->entry.boot_id = f->header->tail_entry_boot_id; + o->entry.boot_id = f->header->tail_entry_boot_id = *boot_id; for (size_t i = 0; i < n_items; i++) write_entry_item(f, o, i, &items[i]); |