summaryrefslogtreecommitdiff
path: root/eio.c
diff options
context:
space:
mode:
Diffstat (limited to 'eio.c')
-rw-r--r--eio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/eio.c b/eio.c
index 383c940..1dfc7a4 100644
--- a/eio.c
+++ b/eio.c
@@ -921,11 +921,17 @@ eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self)
off_t sbytes;
res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0);
+ #if 0 /* according to the manpage, this is correct, but broken behaviour */
/* freebsd' sendfile will return 0 on success */
/* freebsd 8 documents it as only setting *sbytes on EINTR and EAGAIN, but */
/* not on e.g. EIO or EPIPE - sounds broken */
if ((res < 0 && (errno == EAGAIN || errno == EINTR) && sbytes) || res == 0)
res = sbytes;
+ #endif
+
+ /* according to source inspection, this is correct, and useful behaviour */
+ if (sbytes)
+ res = sbytes;
}
# elif defined (__APPLE__)