]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: return 0 from _skip() when it didn't skip
authorLars Karlitski <lars@karlitski.net>
Thu, 11 May 2017 20:18:54 +0000 (22:18 +0200)
committerLars Karlitski <lars@karlitski.net>
Thu, 11 May 2017 20:49:20 +0000 (22:49 +0200)
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

index 86afb4985d8381ebda98a4091391fd65890e1fb3..cd56470a33a86aea9b43778e6da587c9ca00b1eb 100644 (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;
         }