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()).
This commit is contained in:
Lars Karlitski
2017-05-11 22:49:20 +02:00
parent 271312e37b
commit 0488435496
+5 -2
View File
@@ -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;
}