[systemd-devel] [PATCH] journalctl: respect --after-cursor semantics with --follow in all cases
Lennart Poettering
lennart at poettering.net
Mon Dec 8 17:41:27 PST 2014
On Sun, 30.11.14 23:27, Wesley Dawson (whd at mozilla.com) wrote:
> 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.
Looks good! Applied!
> ---
> src/journal/journalctl.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
> index 5c2a56d..3cec9a0 100644
> --- a/src/journal/journalctl.c
> +++ b/src/journal/journalctl.c
> @@ -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);
> --
> 1.9.3
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list