mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
sd-journal: fix segfault
Unfortunately, journal_file_next_entry() returns 0 when the next entry not found. The commitcc938e4a0aadds FIXME comment about that. We should really fix that, but the function and its return value are used in many place, hence checking all usecases is not easy. So, let's workaround that here, and handle the 0 return value by the caller. Follow-up for34af74946e. Fixes #26822.
This commit is contained in:
committed by
Luca Boccassi
parent
77c26cd62a
commit
3b1b0f1aeb
@@ -2436,6 +2436,8 @@ static int journal_file_read_tail_timestamp(sd_journal *j, JournalFile *f) {
|
||||
r = journal_file_next_entry(f, 0, DIRECTION_UP, &o, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
return -ENODATA;
|
||||
|
||||
id = o->entry.boot_id;
|
||||
mo = le64toh(o->entry.monotonic);
|
||||
|
||||
Reference in New Issue
Block a user