mirror of
https://github.com/systemd/systemd.git
synced 2024-12-01 06:13:38 +08:00
journal-file: when iterating through a partly corruped journal file, treat error like EOF
When we linearly iterate through a corrupted journal file, and we encounter a read error, don't consider this fatal, but merely as EOF condition (and log about it).
This commit is contained in:
parent
bd30fdf213
commit
caeab8f626
@ -2469,12 +2469,18 @@ int journal_file_next_entry(
|
||||
le64toh(f->header->entry_array_offset),
|
||||
i,
|
||||
ret, &ofs);
|
||||
if (r == -EBADMSG && direction == DIRECTION_DOWN) {
|
||||
/* Special case: when we iterate throught the journal file linearly, and hit an entry we can't read,
|
||||
* consider this the end of the journal file. */
|
||||
log_debug_errno(r, "Encountered entry we can't read while iterating through journal file. Considering this the end of the file.");
|
||||
return 0;
|
||||
}
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
if (p > 0 &&
|
||||
(direction == DIRECTION_DOWN ? ofs <= p : ofs >= p)) {
|
||||
log_debug("%s: entry array corrupted at entry %"PRIu64, f->path, i);
|
||||
log_debug("%s: entry array corrupted at entry %" PRIu64, f->path, i);
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user