From fecea437a7272916e00228b99b74e05ee8e0c957 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 7 Sep 2018 12:04:14 -0600 Subject: [PATCH] client: use temp buffer for client text output Don't split it into pieces, log it into a local buffer and then flush it all at once. Signed-off-by: Jens Axboe --- client.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index 31c7c649..2d8a2bb1 100644 --- a/client.c +++ b/client.c @@ -1144,13 +1144,16 @@ static void handle_text(struct fio_client *client, struct fio_net_cmd *cmd) const char *buf = (const char *) pdu->buf; const char *name; int fio_unused ret; + struct buf_output out; + + buf_output_init(&out); name = client->name ? client->name : client->hostname; if (!client->skip_newline && !(output_format & FIO_OUTPUT_TERSE)) - fprintf(f_out, "<%s> ", name); - ret = fwrite(buf, pdu->buf_len, 1, f_out); - fflush(f_out); + log_buf(&out, "<%s> ", name); + log_buf(&out, "%s", buf); + log_info_buf(out.buf, out.buflen); client->skip_newline = strchr(buf, '\n') == NULL; } -- 2.25.1