If copy_file_range(2) fails with EXDEV, use fall-back.

This commit is contained in:
Poul-Henning Kamp 2023-04-04 07:39:59 +00:00
parent 396b6914c9
commit 6433365490

View File

@ -180,7 +180,7 @@ copy_file(const FTSENT *entp, int dne)
if (use_copy_file_range) {
wcount = copy_file_range(from_fd, NULL,
to_fd, NULL, SSIZE_MAX, 0);
if (wcount < 0 && errno == EINVAL) {
if (wcount < 0 && (errno == EINVAL || errno == EXDEV)) {
/* Prob a non-seekable FD */
use_copy_file_range = 0;
}