From 0488435496a9a0215fbd5c3168a53c0592df8eed Mon Sep 17 00:00:00 2001 From: Lars Karlitski Date: Thu, 11 May 2017 22:18:54 +0200 Subject: [PATCH] journal: return 0 from _skip() when it didn't skip Seeking to the tail and calling `sd_journal_previous_skip(journal, 0)` was equivalent to calling it with skip == 1 (same for head and next()). --- src/journal/sd-journal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 86afb4985d..cd56470a33 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -882,8 +882,11 @@ static int real_journal_next_skip(sd_journal *j, direction_t direction, uint64_t if (skip == 0) { /* If this is not a discrete skip, then at least * resolve the current location */ - if (j->current_location.type != LOCATION_DISCRETE) - return real_journal_next(j, direction); + if (j->current_location.type != LOCATION_DISCRETE) { + r = real_journal_next(j, direction); + if (r < 0) + return r; + } return 0; }