geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit eb18ab03d6c767aa5f355d802b00ad7ec2a3055f
parent efab0d1f664ac58350ead1e8e7259a31916babe1
Author: Christoph Lohmann <20h@r-36.net>
Date:   Thu, 23 Aug 2018 13:42:28 +0200

Do more sendfile, in case sendfile did not send everything.

Diffstat:
ind.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/ind.c b/ind.c @@ -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 *