X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=nettest%2Ffillfile.c;fp=nettest%2Ffillfile.c;h=d87404fb816bd40681be89c5dbbde677ab1cf977;hb=fb02ff37cdd2d0da7fefd0391195b3e7534fbaa1;hp=002f3a68e2f400b54339423ee3b6b86494681a59;hpb=59292f8b1865ceabfa75cde1102c245c25f6b85e;p=splice.git diff --git a/nettest/fillfile.c b/nettest/fillfile.c index 002f3a6..d87404f 100644 --- a/nettest/fillfile.c +++ b/nettest/fillfile.c @@ -69,12 +69,18 @@ static int fill_file(int fd) unsigned long long fs = (unsigned long long) file_size * 1024 * 1024ULL; while (fs) { + int ret; + if (fs < msg_size) break; fill_buf(m, msg_size); - write(fd, m, msg_size); - fs -= msg_size; + ret = write(fd, m, msg_size); + if (ret < 0) { + perror("write"); + return -1; + } + fs -= ret; } close(fd);