diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-03-27 18:50:34 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-03-27 18:50:34 +0200 |
commit | 6030831d5b85539a2a209b6d3a6f28b400207d78 (patch) | |
tree | 04934ee7676ffc0ffc48a8cde75af15ba92782d0 /src/journal | |
parent | 623ac9d2fce3170125ead9be20f56bfe68ea125e (diff) |
journal: properly handle if we interleave files with different boot ids
If we try to locate a monotonic time in a file that doesn't have any
entries with the matching boot id, then don't fail on it, simply
fall back to calendar time.
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/sd-journal.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index e9cd26e95c..92ba57822b 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -325,9 +325,17 @@ static int find_location(sd_journal *j, JournalFile *f, direction_t direction, O else if (j->current_location.seqnum_set && sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id)) r = journal_file_move_to_entry_by_seqnum(f, j->current_location.seqnum, direction, &o, &p); - else if (j->current_location.monotonic_set) + else if (j->current_location.monotonic_set) { r = journal_file_move_to_entry_by_monotonic(f, j->current_location.boot_id, j->current_location.monotonic, direction, &o, &p); - else if (j->current_location.realtime_set) + + if (r == -ENOENT) { + /* boot id unknown in this file */ + if (j->current_location.realtime_set) + r = journal_file_move_to_entry_by_realtime(f, j->current_location.realtime, direction, &o, &p); + else + r = journal_file_next_entry(f, NULL, 0, direction, &o, &p); + } + } else if (j->current_location.realtime_set) r = journal_file_move_to_entry_by_realtime(f, j->current_location.realtime, direction, &o, &p); else r = journal_file_next_entry(f, NULL, 0, direction, &o, &p); |