summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/src/unix/fs.c')
-rw-r--r--deps/uv/src/unix/fs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
index 52082e9347..d739c28258 100644
--- a/deps/uv/src/unix/fs.c
+++ b/deps/uv/src/unix/fs.c
@@ -574,7 +574,14 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
r = sendfile(in_fd, out_fd, req->off, &len, NULL, 0);
#endif
- if (r != -1 || len != 0) {
+ /*
+ * The man page for sendfile(2) on DragonFly states that `len` contains
+ * a meaningful value ONLY in case of EAGAIN and EINTR.
+ * Nothing is said about it's value in case of other errors, so better
+ * not depend on the potential wrong assumption that is was not modified
+ * by the syscall.
+ */
+ if (r == 0 || ((errno == EAGAIN || errno == EINTR) && len != 0)) {
req->off += len;
return (ssize_t) len;
}