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 c89bef327e78a4c0400b3665d249d36af6a3160b
parent eb18ab03d6c767aa5f355d802b00ad7ec2a3055f
Author: Christoph Lohmann <20h@r-36.net>
Date:   Thu, 23 Aug 2018 14:00:21 +0200

Sendfile in Linux and FreeBSD are different.

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

diff --git a/ind.c b/ind.c @@ -174,18 +174,16 @@ 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__ + for (sent = 0; count > 0; count -= sent) { sent = sendfile(sock, fd, 0, count); -#endif -#if defined(__FreeBSD__) || defined(__DragonFly__) - sent = sendfile(fd, sock, 0, count, NULL, NULL, 0); -#endif if (sent < 0) return -1; } #endif +#if defined(__FreeBSD__) || defined(__DragonFly__) + return sendfile(fd, sock, 0, count, NULL, NULL, 0); +#endif return 0; }