Skip to content

Commit

Permalink
unix: check for EXDEV for uv__fs_copy_file_range
Browse files Browse the repository at this point in the history
copy_file_range will not work when in_fd and out_fd
are not on the same mounted filesystem (pre Linux 5.3).

Fixes: nodejs/node#37284
Refs: https://www.man7.org/linux/man-pages/man2/copy_file_range.2.html#ERRORS
  • Loading branch information
RaisinTen committed Feb 13, 2021
1 parent 217fdf4 commit 550dce9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/unix/fs.c
Expand Up @@ -929,6 +929,11 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
} else if (r == -1 && errno == ENOTSUP) {
/* ENOTSUP - it could work on another file system type */
errno = 0;
} else if (r == -1 && errno == EXDEV) {
/* 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;
}
Expand Down

0 comments on commit 550dce9

Please sign in to comment.