| Date: Thu, 23 Aug 2018 13:42:28 +0200
Do more sendfile, in case sendfile did not send everything.
Diffstat:
M ind.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- |
| @@ -174,13 +174,20 @@ xsendfile(int fd, int sock)
}
/* Different sendfile(2) implementations on different platforms. :/ */
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
+ for (sent = 0; count > 0; count -= sent) {
#ifdef __linux__
- return sendfile(sock, fd, NULL, count);
+ sent = sendfile(sock, fd, 0, count);
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
- return sendfile(fd, sock, 0, count, NULL, NULL, 0);
+ sent = sendfile(fd, sock, 0, count, NULL, NULL, 0);
#endif
- return -1;
+ if (sent < 0)
+ return -1;
+ }
+#endif
+
+ return 0;
}
void * |