From: Yu Watanabe Date: Fri, 22 Sep 2023 17:42:31 +0000 (+0900) Subject: sd-journal: boot_id is always non-NULL X-Git-Tag: v255-rc1~414^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b761ae0fca48bbfe755be4f363e210c148b21140;p=thirdparty%2Fsystemd.git sd-journal: boot_id is always non-NULL The two callers of journal_file_append_entry_internal() always pass non-NULL boot ID. --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 638a6e1f9d6..872f16b386c 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]);