From 663588e68e66b0fd3d588db9ad3dc5e3cf3ee577 Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Mon, 14 Dec 2020 17:03:31 +0100 Subject: [PATCH] unix: check for partial copy_file_range support Fixes: https://github.com/libuv/libuv/issues/3069 PR-URL: https://github.com/libuv/libuv/pull/3070 Reviewed-By: Richard Lau Reviewed-By: Santiago Gimeno --- src/unix/fs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/unix/fs.c b/src/unix/fs.c index 0d36103b..88ac0731 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -923,8 +923,12 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) { r = uv__fs_copy_file_range(in_fd, &off, out_fd, NULL, req->bufsml[0].len, 0); if (r == -1 && errno == ENOSYS) { + /* ENOSYS - it will never work */ errno = 0; copy_file_range_support = 0; + } else if (r == -1 && errno == ENOTSUP) { + /* ENOTSUP - it could work on another file system type */ + errno = 0; } else { goto ok; }