iDo more sendfile, in case sendfile did not send everything. - geomyidae - A small C-based gopherd. Err bitreich.org 70 hgit clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ URL:git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ bitreich.org 70 1Log /scm/geomyidae/log.gph bitreich.org 70 1Files /scm/geomyidae/files.gph bitreich.org 70 1Refs /scm/geomyidae/refs.gph bitreich.org 70 1Tags /scm/geomyidae/tag bitreich.org 70 1README /scm/geomyidae/file/README.gph bitreich.org 70 1LICENSE /scm/geomyidae/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit eb18ab03d6c767aa5f355d802b00ad7ec2a3055f /scm/geomyidae/commit/eb18ab03d6c767aa5f355d802b00ad7ec2a3055f.gph bitreich.org 70 1parent efab0d1f664ac58350ead1e8e7259a31916babe1 /scm/geomyidae/commit/efab0d1f664ac58350ead1e8e7259a31916babe1.gph bitreich.org 70 hAuthor: Christoph Lohmann <20h@r-36.net> URL:mailto:20h@r-36.net bitreich.org 70 iDate: Thu, 23 Aug 2018 13:42:28 +0200 Err bitreich.org 70 i Err bitreich.org 70 iDo more sendfile, in case sendfile did not send everything. Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M ind.c | 13 ++++++++++--- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 10 insertions(+), 3 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/ind.c b/ind.c /scm/geomyidae/file/ind.c.gph bitreich.org 70 i@@ -174,13 +174,20 @@ xsendfile(int fd, int sock) Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i /* Different sendfile(2) implementations on different platforms. :/ */ Err bitreich.org 70 i+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) Err bitreich.org 70 i+ for (sent = 0; count > 0; count -= sent) { Err bitreich.org 70 i #ifdef __linux__ Err bitreich.org 70 i- return sendfile(sock, fd, NULL, count); Err bitreich.org 70 i+ sent = sendfile(sock, fd, 0, count); Err bitreich.org 70 i #endif Err bitreich.org 70 i #if defined(__FreeBSD__) || defined(__DragonFly__) Err bitreich.org 70 i- return sendfile(fd, sock, 0, count, NULL, NULL, 0); Err bitreich.org 70 i+ sent = sendfile(fd, sock, 0, count, NULL, NULL, 0); Err bitreich.org 70 i #endif Err bitreich.org 70 i- return -1; Err bitreich.org 70 i+ if (sent < 0) Err bitreich.org 70 i+ return -1; Err bitreich.org 70 i+ } Err bitreich.org 70 i+#endif Err bitreich.org 70 i+ Err bitreich.org 70 i+ return 0; Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i void * Err bitreich.org 70 .