unix: check for EXDEV in uv__fs_sendfile()

copy_file_range will not work when in_fd and out_fd
are not on the same mounted filesystem (pre Linux 5.3).

Refs: https://github.com/nodejs/node/issues/37284
PR-URL: https://github.com/libuv/libuv/pull/3108
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
Darshan Sen 2021-02-13 20:53:06 +05:30 committed by cjihrig
parent 217fdf4265
commit 70f67d8e05
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -926,8 +926,10 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
/* ENOSYS - it will never work */
errno = 0;
copy_file_range_support = 0;
} else if (r == -1 && errno == ENOTSUP) {
} else if (r == -1 && (errno == ENOTSUP || errno == EXDEV)) {
/* ENOTSUP - it could work on another file system type */
/* EXDEV - it will not work when in_fd and out_fd are not on the same
mounted filesystem (pre Linux 5.3) */
errno = 0;
} else {
goto ok;