From ef90afd59e8f18f78af5a4111aefaa9cea73f048 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 27 Nov 2025 13:01:59 +0100 Subject: [PATCH] journal: send READY=1 also when --lines=0 is given If --lines=0 is given, we'd skip the setup and not invoke sd_notify, potentially blocking the caller. Change the condition for the callback to also include that case. Since then the callback would always be set, the 'if' statement is not necessary anymore. --- src/journal/journalctl-show.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/journal/journalctl-show.c b/src/journal/journalctl-show.c index c48c2e47eb9..4ebedb092e8 100644 --- a/src/journal/journalctl-show.c +++ b/src/journal/journalctl-show.c @@ -362,7 +362,9 @@ static int on_first_event(sd_event_source *s, void *userdata) { return log_error_errno(r, "Failed to get cursor: %m"); } + /* Setup and initial processing are done, we're ready to wait for more data. */ (void) sd_notify(/* unset_environment= */ false, "READY=1"); + return 0; } @@ -472,11 +474,9 @@ static int setup_event(Context *c, int fd) { else if (r < 0) return log_error_errno(r, "Failed to add io event source for stdout: %m"); - if (arg_lines != 0 || arg_since_set) { - r = sd_event_add_defer(e, NULL, on_first_event, c); - if (r < 0) - return log_error_errno(r, "Failed to add defer event source: %m"); - } + r = sd_event_add_defer(e, NULL, on_first_event, c); + if (r < 0) + return log_error_errno(r, "Failed to add defer event source: %m"); c->event = TAKE_PTR(e); return 0; @@ -583,6 +583,7 @@ int action_show(char **matches) { return 0; } + /* Setup is done, we'll start processing data. */ (void) sd_notify(/* unset_environment= */ false, "READY=1"); r = show(&c); -- 2.47.3