summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/journal/test-journal-interleaving.c5
-rw-r--r--src/libsystemd/sd-journal/journal-file.c5
-rw-r--r--src/libsystemd/sd-journal/journal-file.h3
3 files changed, 9 insertions, 4 deletions
diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c
index 8dcdaecc65..21c5bdddae 100644
--- a/src/journal/test-journal-interleaving.c
+++ b/src/journal/test-journal-interleaving.c
@@ -225,9 +225,8 @@ static void test_skip_one(void (*setup)(void)) {
assert_ret(sd_journal_open_directory(&j, t, 0));
assert_ret(sd_journal_seek_tail(j));
assert_se(sd_journal_previous(j) == 1); /* pointing to the last entry */
- // FIXME: the below does not work. See issue #29216.
- //assert_ret(sd_journal_seek_tail(j));
- //assert_se(sd_journal_previous(j) == 1); /* pointing to the last entry */
+ assert_ret(sd_journal_seek_tail(j));
+ assert_se(sd_journal_previous(j) == 1); /* pointing to the last entry */
test_check_numbers_up(j, 9);
sd_journal_close(j);
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
index 95cf25bff0..b21d29f6ea 100644
--- a/src/libsystemd/sd-journal/journal-file.c
+++ b/src/libsystemd/sd-journal/journal-file.c
@@ -3343,6 +3343,10 @@ void journal_file_reset_location(JournalFile *f) {
f->current_monotonic = 0;
zero(f->current_boot_id);
f->current_xor_hash = 0;
+
+ /* Also reset the previous reading direction. Otherwise, next_beyond_location() may wrongly handle we
+ * already hit EOF. See issue #29216. */
+ f->last_direction = _DIRECTION_INVALID;
}
void journal_file_save_location(JournalFile *f, Object *o, uint64_t offset) {
@@ -3939,6 +3943,7 @@ int journal_file_open(
MAX(MIN_COMPRESS_THRESHOLD, compress_threshold_bytes),
.strict_order = FLAGS_SET(file_flags, JOURNAL_STRICT_ORDER),
.newest_boot_id_prioq_idx = PRIOQ_IDX_NULL,
+ .last_direction = _DIRECTION_INVALID,
};
if (fname) {
diff --git a/src/libsystemd/sd-journal/journal-file.h b/src/libsystemd/sd-journal/journal-file.h
index a4d8912aa8..b018fd8788 100644
--- a/src/libsystemd/sd-journal/journal-file.h
+++ b/src/libsystemd/sd-journal/journal-file.h
@@ -31,7 +31,8 @@ typedef struct JournalMetrics {
typedef enum direction {
DIRECTION_UP,
- DIRECTION_DOWN
+ DIRECTION_DOWN,
+ _DIRECTION_INVALID = -EINVAL,
} direction_t;
typedef enum LocationType {