coreutils/coreutils-8.32-copy-swap.patch

33 lines
1.1 KiB
Diff

From f9936f7d2db6edd423b9d6327e2b284d86b6a1f5 Mon Sep 17 00:00:00 2001
From: Zorro Lang <zlang@redhat.com>
Date: Mon, 26 Apr 2021 17:25:18 +0200
Subject: [PATCH] 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)
Upstream-commit: 785478013b416cde50794be35475c0c4fdbb48b4
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/copy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/copy.c b/src/copy.c
index 4050f69..1798bb7 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;
--
2.30.2