chiark / gitweb /
journalctl: respect --after-cursor semantics with --follow in all cases
authorWesley Dawson <whd@mozilla.com>
Mon, 1 Dec 2014 07:27:00 +0000 (23:27 -0800)
committerLennart Poettering <lennart@poettering.net>
Tue, 9 Dec 2014 01:40:16 +0000 (02:40 +0100)
In the case where no entries have been added to the journal after the specified
cursor, set need_seek before the main loop to prevent display of the entry at
said cursor.

src/journal/journalctl.c

index 5c2a56d575620e75b58996735d096f85e9b6845c..3cec9a0c84e936e8d720873bf78983cdb76d3704 100644 (file)
@@ -1934,9 +1934,13 @@ int main(int argc, char *argv[]) {
                 else
                         r = sd_journal_previous_skip(j, 1 + !!arg_after_cursor);
 
-                if (arg_after_cursor && r < 2 && !arg_follow)
+                if (arg_after_cursor && r < 2) {
                         /* We couldn't find the next entry after the cursor. */
-                        arg_lines = 0;
+                        if (arg_follow)
+                                need_seek = true;
+                        else
+                                arg_lines = 0;
+                }
 
         } else if (arg_since_set && !arg_reverse) {
                 r = sd_journal_seek_realtime_usec(j, arg_since);