From: Zorro Lang Date: Mon, 26 Apr 2021 15:25:18 +0000 (+0200) Subject: copy: do not refuse to copy a swap file X-Git-Tag: v9.0~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=785478013b416cde50794be35475c0c4fdbb48b4;p=thirdparty%2Fcoreutils.git copy: do not refuse to copy a swap file * src/copy.c (sparse_copy): Fallback to read() if copy_file_range() fails with ETXTBSY. Otherwise it would be impossible to copy files that are being used as swap. This used to work before introducing the support for copy_file_range() in coreutils. (Bug#48036) --- diff --git a/src/copy.c b/src/copy.c index 9dbc694ebe..b7ec9747fa 100644 --- a/src/copy.c +++ b/src/copy.c @@ -290,7 +290,7 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, if (n_copied < 0) { if (errno == ENOSYS || errno == EINVAL - || errno == EBADF || errno == EXDEV) + || errno == EBADF || errno == EXDEV || errno == ETXTBSY) break; if (errno == EINTR) n_copied = 0;