From: Zbigniew Jędrzejewski-Szmek Date: Thu, 27 Nov 2025 12:01:59 +0000 (+0100) Subject: journal: send READY=1 also when --lines=0 is given X-Git-Tag: v259-rc3~42^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef90afd59e8f18f78af5a4111aefaa9cea73f048;p=thirdparty%2Fsystemd.git 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. --- 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);