Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In order to create a cursor, the journal must be at a valid entry. As the docs say: Note that sd_journal_get_cursor() will not work before sd_journal_next(3) (or related call) has been called at least once, in order to position the read pointer at a valid entry. The existing tests do this, but at least on recent versions of systemd (255), calling sd_journal_next after a seek to tail does not meet this requirement. If the journal is at the tail, subsequent nexts will always stay a the abstract 'tail' position (analogous to EOF), not at a valid entry. This causes cursor creation to fail. A similar issue exists in the 'match' test. It seeks to tail and then attempts to 'next' in a loop, but this will always be 'tail', so it never sees the matching entry. In both cases, the fix is to 'previous' after the seek to tail.
- Loading branch information