diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-04-26 11:38:39 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-04-26 12:00:49 +0200 |
commit | caeab8f626e709569cc492b75eb7e119076059e7 (patch) | |
tree | 50b419e23441cfc007bb1895f55ef4a3b7b57d0c /src | |
parent | bd30fdf213c830002aaf48a0d840c011f739ce8f (diff) |
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).
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/journal-file.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index e13ae05990..c97b3f9882 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -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; } |