From: Frantisek Sumsal Date: Thu, 9 Nov 2023 12:24:57 +0000 (+0100) Subject: journal: recalculate line_max when stdout stream state changes X-Git-Tag: v255-rc2~46^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d603e3d58c77c66dc411c1c5b6575c45ea1d6a8d;p=thirdparty%2Fsystemd.git journal: recalculate line_max when stdout stream state changes Otherwise we might still use the more restrictive limit when we get to STDOUT_STREAM_RUNNING, causing unexpected line breaks in the journal messages. Follow-up to: 80e9720616 Resolves: #29916 --- diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 05a715e46bd..81a0e682817 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -502,19 +502,21 @@ static int stdout_stream_scan( LineBreak force_flush, size_t *ret_consumed) { - size_t consumed = 0, line_max; + size_t consumed = 0; int r; assert(s); assert(p); - line_max = stdout_stream_line_max(s); for (;;) { LineBreak line_break; size_t skip, found; char *end1, *end2; - size_t tmp_remaining = MIN(remaining, line_max); + size_t tmp_remaining, line_max; + + line_max = stdout_stream_line_max(s); + tmp_remaining = MIN(remaining, line_max); end1 = memchr(p, '\n', tmp_remaining); end2 = memchr(p, 0, end1 ? (size_t) (end1 - p) : tmp_remaining);