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 <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Momtchil Momtchev 2020-12-14 17:03:31 +01:00 committed by Santiago Gimeno
parent b2ccbbb8a4
commit 663588e68e
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE

View File

@ -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;
}