]> git.ipfire.org Git - thirdparty/systemd.git/commit
journalctl: fix --follow with non-matching filter 27519/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 28 May 2023 05:28:32 +0000 (14:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 28 May 2023 14:53:58 +0000 (23:53 +0900)
commit80ec3db5c7a4cfef237d4a1a3d33097bd4b50ec4
treef73be73248dd20f5304f5ed250013c31e5d865bc
parentb78f9481bc03455eafd9239c33fc2f124779760c
journalctl: fix --follow with non-matching filter

When there is no matching entry stored in journal, then initial call of
`sd_journal_previous()` following `sd_journal_seek_tail()` returns
zero, and does not move the read pointer.
In the main loop, on every journal event, we call `sd_journal_next()`,
even though the current location is tail, and it takes no effect.

In such a case, we need to call `sd_journal_previous()` instead of
`sd_journal_next()`.
src/journal/journalctl.c
test/units/testsuite-04.sh