]> git.ipfire.org Git - thirdparty/systemd.git/commit
journalctl: fix output when --lines is used with --grep
authorMike Yuan <me@yhndnzj.com>
Sat, 18 Feb 2023 13:49:21 +0000 (21:49 +0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Feb 2023 22:06:49 +0000 (07:06 +0900)
commitdb4691961ca52759fe6645d0fddb659ee4299ac2
treeec0627f3f7825a05acd1199deef37f4f9b362c35
parent2421dd72674d55bd8ed026bdf47939cbda26152f
journalctl: fix output when --lines is used with --grep

Previously, we skip the entries before arg_lines
unconditionally, which doesn't behave correctly
when used with --grep. After this commit, when
a pattern is specified, we don't skip the entries
early, but rely on the count of the lines shown
to tell us when to stop. To achieve that we would
have to search backwards instead.

Fixes #25147
man/journalctl.xml
src/journal/journalctl.c