Merge pull request #5930 from larskarlitski/journal-skip

journal: return 0 from _skip() when skip is 0
This commit is contained in:
Lennart Poettering
2017-06-27 22:10:38 +02:00
committed by GitHub
2 changed files with 11 additions and 12 deletions
+6 -10
View File
@@ -2365,20 +2365,13 @@ int main(int argc, char *argv[]) {
log_error_errno(r, "Failed to iterate through journal: %m");
goto finish;
}
if (r == 0) {
if (arg_follow)
need_seek = true;
else {
if (!arg_quiet)
printf("-- No entries --\n");
goto finish;
}
}
if (r == 0)
need_seek = true;
if (!arg_follow)
pager_open(arg_no_pager, arg_pager_end);
if (!arg_quiet) {
if (!arg_quiet && (arg_lines != 0 || arg_follow)) {
usec_t start, end;
char start_buf[FORMAT_TIMESTAMP_MAX], end_buf[FORMAT_TIMESTAMP_MAX];
@@ -2474,6 +2467,9 @@ int main(int argc, char *argv[]) {
}
if (!arg_follow) {
if (n_shown == 0 && !arg_quiet)
printf("-- No entries --\n");
if (arg_show_cursor) {
_cleanup_free_ char *cursor = NULL;
+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;
}