From 6b2978b394f5fbab94b4c5692ec8eb5f16b3f6e9 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 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 Reviewed-By: Richard Lau --- src/unix/fs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/unix/fs.c b/src/unix/fs.c index 88ac07312c7..fd7ae08755f 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -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;