summaryrefslogtreecommitdiff
path: root/src/journal/journald-stream.c
diff options
context:
space:
mode:
authorBenjamin Robin <dev@benjarobin.fr>2020-05-03 18:37:21 +0200
committerLennart Poettering <lennart@poettering.net>2020-05-13 21:31:58 +0200
commit034e9719ac1ba88a36b05da38c7aa98761d42c77 (patch)
tree050265a2ed08d2f1eabe8ac5319856f606b43188 /src/journal/journald-stream.c
parente65848175fe7ce79c724625aad2381886026bc1d (diff)
downloadsystemd-034e9719ac1ba88a36b05da38c7aa98761d42c77.tar.gz
journald: Increase stdout buffer size sooner, when almost full
If the previous received buffer length is almost equal to the allocated buffer size, before this change the next read can only receive a couple of bytes (in the worst case only 1 byte), which is not efficient.
Diffstat (limited to 'src/journal/journald-stream.c')
-rw-r--r--src/journal/journald-stream.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index 4dadbd62be..6c10bfc259 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -511,8 +511,8 @@ static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents,
goto terminate;
}
- /* If the buffer is full already (discounting the extra NUL we need), add room for another 1K */
- if (s->length + 1 >= s->allocated) {
+ /* If the buffer is almost full, add room for another 1K */
+ if (s->length + 512 >= s->allocated) {
if (!GREEDY_REALLOC(s->buffer, s->allocated, s->length + 1 + 1024)) {
log_oom();
goto terminate;