coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] copy: handle ENOTSUP from copy_file_range()


From: Pádraig Brady
Subject: [PATCH] copy: handle ENOTSUP from copy_file_range()
Date: Sat, 8 May 2021 17:24:13 +0100

* src/copy.c (sparse_copy): Ensure we fall back to
a standard copy if copy_file_range() returns ENOTSUP.
This generally is best checked when checking ENOSYS,
but it also seems to be a practical concern on Centos 7,
as a quick search gave https://bugzilla.redhat.com/1840284
---
 src/copy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/copy.c b/src/copy.c
index 26ab909fd..3a57da9fe 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -290,8 +290,9 @@ 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 == ETXTBSY)
+            if (errno == ENOSYS || is_ENOTSUP(errno)
+                || errno == EINVAL || errno == EBADF
+                || errno == EXDEV || errno == ETXTBSY)
               break;
             if (errno == EINTR)
               n_copied = 0;
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]