From 771f275ca03b5741612b1423b0005770209cba02 Mon Sep 17 00:00:00 2001 From: quackerd Date: Tue, 14 Mar 2023 09:32:55 +0100 Subject: [PATCH] remove read from sendfile code path --- src/iperf_api.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/iperf_api.c b/src/iperf_api.c index 6d6ee84..563aa76 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -4657,6 +4657,10 @@ diskfile_send(struct iperf_stream *sp) } r = read(sp->diskfile_fd, sp->buffer, sp->test->settings->blksize - sp->diskfile_left); + if (r <= 0) { + iperf_err(sp->test, "read failed again %d errno %d\n", r, errno); + return -1; + } } if (r < 0) { iperf_err(sp->test, "read failed with %d\n", errno);