1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-31 21:18:09 +03:00

sd-journal: refuse to write entry without boot ID

To make journal entries always contain valid boot ID.
This commit is contained in:
Yu Watanabe 2023-09-23 04:14:31 +09:00
parent b761ae0fca
commit 1eede15851

View File

@ -2299,6 +2299,7 @@ static int journal_file_append_entry_internal(
assert(f->header);
assert(ts);
assert(boot_id);
assert(!sd_id128_is_null(*boot_id));
assert(items || n_items == 0);
if (f->strict_order) {
@ -2528,7 +2529,10 @@ int journal_file_append_entry(
ts = &_ts;
}
if (!boot_id) {
if (boot_id) {
if (sd_id128_is_null(*boot_id))
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "Empty boot ID, refusing entry.");
} else {
r = sd_id128_get_boot(&_boot_id);
if (r < 0)
return r;