From 550dce92152f0b2217b4eab8e48fcf02e6311606 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Sat, 13 Feb 2021 20:53:06 +0530 Subject: [PATCH] unix: check for EXDEV for uv__fs_copy_file_range copy_file_range will not work when in_fd and out_fd are not on the same mounted filesystem (pre Linux 5.3). Fixes: https://github.com/nodejs/node/issues/37284 Refs: https://www.man7.org/linux/man-pages/man2/copy_file_range.2.html#ERRORS --- src/unix/fs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/unix/fs.c b/src/unix/fs.c index 88ac07312c7..fa39b987606 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -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; }