diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-09-22 21:14:31 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-09-26 06:26:22 +0200 |
commit | 1eede158519e4e5ed22738c90cb57a91dbecb7f2 (patch) | |
tree | 262aa59713067f1c0d24c5ffd41e6357dd41de2f /src/libsystemd/sd-journal/journal-file.c | |
parent | sd-journal: boot_id is always non-NULL (diff) | |
download | systemd-1eede158519e4e5ed22738c90cb57a91dbecb7f2.tar.xz systemd-1eede158519e4e5ed22738c90cb57a91dbecb7f2.zip |
sd-journal: refuse to write entry without boot ID
To make journal entries always contain valid boot ID.
Diffstat (limited to 'src/libsystemd/sd-journal/journal-file.c')
-rw-r--r-- | src/libsystemd/sd-journal/journal-file.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 872f16b386..ab25ff87bc 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -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; |