summaryrefslogtreecommitdiff
path: root/src/journal/journal-file.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-07-12 17:36:04 +0200
committerLennart Poettering <lennart@poettering.net>2012-07-13 00:32:32 +0200
commita536e2613f278970b1ab11788caf1a9a51e1a103 (patch)
tree5db26c80d1c827de0652044f4636a1e6824e1d48 /src/journal/journal-file.c
parentc4aff78b2dffc1405396bff2458e479d0a19d93b (diff)
journal: fix bisection logic for first entry
Diffstat (limited to 'src/journal/journal-file.c')
-rw-r--r--src/journal/journal-file.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index db64a32e61..c468b22697 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1275,7 +1275,11 @@ static int generic_array_bisect_plus_one(JournalFile *f,
r = test_object(f, extra, needle);
if (r < 0)
return r;
- else if (r == TEST_FOUND) {
+
+ if (r == TEST_FOUND)
+ r = direction == DIRECTION_DOWN ? TEST_RIGHT : TEST_LEFT;
+
+ if (r == TEST_RIGHT) {
Object *o;
r = journal_file_move_to_object(f, OBJECT_ENTRY, extra, &o);
@@ -1292,8 +1296,7 @@ static int generic_array_bisect_plus_one(JournalFile *f,
*idx = 0;
return 1;
- } else if (r == TEST_RIGHT)
- return 0;
+ }
r = generic_array_bisect(f, first, n-1, needle, test_object, direction, ret, offset, idx);