summaryrefslogtreecommitdiffstats
path: root/src/journal
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-12-19 17:11:22 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-12-19 17:14:11 +0100
commit668c965af4e803f460925dc616f328ed274d1f3a (patch)
treee6c19cc71ac6fc63bab55f9e269b2740c9dd80ed /src/journal
parentjournal: make next_with_matches() always use f->current_offset (diff)
downloadsystemd-668c965af4e803f460925dc616f328ed274d1f3a.tar.xz
systemd-668c965af4e803f460925dc616f328ed274d1f3a.zip
journal: skipping of exhausted journal files is bad if direction changed
EOF is meaningless if the direction of iteration changes. Move the EOF optimization under the direction check. This fixes test-journal-interleaving for me. Thanks to Filipe Brandenburger for telling me about the failure.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/sd-journal.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 89cab37331..d46dc3c29c 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -723,13 +723,13 @@ static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc
assert(j);
assert(f);
- /* If we hit EOF before, recheck if any new entries arrived. */
- n_entries = le64toh(f->header->n_entries);
- if (f->location_type == LOCATION_TAIL && n_entries == f->last_n_entries)
- return 0;
- f->last_n_entries = n_entries;
-
if (f->last_direction == direction && f->current_offset > 0) {
+ /* If we hit EOF before, recheck if any new entries arrived. */
+ n_entries = le64toh(f->header->n_entries);
+ if (f->location_type == LOCATION_TAIL && n_entries == f->last_n_entries)
+ return 0;
+ f->last_n_entries = n_entries;
+
/* LOCATION_SEEK here means we did the work in a previous
* iteration and the current location already points to a
* candidate entry. */