From: Lars Karlitski Date: Thu, 11 May 2017 20:18:54 +0000 (+0200) Subject: journal: return 0 from _skip() when it didn't skip X-Git-Tag: v234~77^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0488435496a9a0215fbd5c3168a53c0592df8eed;p=thirdparty%2Fsystemd.git 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()). --- diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 86afb4985d8..cd56470a33a 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; }