From f2c17bbcde55677b06506f0c21c11d273ee413fc Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Tue, 4 Jan 2022 19:14:29 +0800 Subject: [PATCH] logcatd: fix sd_journal_seek_tail doesn't go to end (#23319) * fix sd_journal_seek_tail doesn't go to end * add comment --- selfdrive/logcatd/logcatd_systemd.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/selfdrive/logcatd/logcatd_systemd.cc b/selfdrive/logcatd/logcatd_systemd.cc index 7c7800dfe..dabb11adc 100644 --- a/selfdrive/logcatd/logcatd_systemd.cc +++ b/selfdrive/logcatd/logcatd_systemd.cc @@ -24,6 +24,10 @@ int main(int argc, char *argv[]) { err = sd_journal_seek_tail(journal); assert(err >= 0); + // workaround for bug https://github.com/systemd/systemd/issues/9934 + // call sd_journal_previous_skip after sd_journal_seek_tail (like journalctl -f does) to makes things work. + sd_journal_previous_skip(journal, 1); + while (!do_exit) { err = sd_journal_next(journal); assert(err >= 0);