1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

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
This commit is contained in:
Frantisek Sumsal 2023-11-09 13:24:57 +01:00
parent 52c7727f54
commit d603e3d58c

View File

@ -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);