summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-03-25 09:30:22 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2023-03-25 13:20:16 -0700
commit6272817de007d236f82616df5916be37333ba163 (patch)
tree212db7b8eb996d1beee596df688a26b9d9878fb5
parent093a8b4bfaba60005f14493ce7ef11ed665a0176 (diff)
downloadcoreutils-6272817de007d236f82616df5916be37333ba163.tar.gz
cp: clarify commentary
* src/copy.c: Make comments a bit clearer.
-rw-r--r--src/copy.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/copy.c b/src/copy.c
index f8ba058d6..a8aa14920 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -278,9 +278,10 @@ create_hole (int fd, char const *name, bool punch_holes, off_t size)
}
-/* Whether the errno indicates the operation is a transient failure.
- I.e., a failure that would indicate the operation _is_ supported,
- but has failed in a terminal way. */
+/* Whether an errno value ERR, set by FICLONE or copy_file_range,
+ indicates that the copying operation has terminally failed, even
+ though it was invoked correctly (so that, e.g, EBADF cannot occur)
+ and even though !is_CLONENOTSUP (ERR). */
static bool
is_terminal_error (int err)
@@ -288,9 +289,9 @@ is_terminal_error (int err)
return err == EIO || err == ENOMEM || err == ENOSPC || err == EDQUOT;
}
-
-/* Whether the errno from FICLONE, or copy_file_range indicates
- the operation is not supported/allowed for this file or process. */
+/* Similarly, whether ERR indicates that the copying operation is not
+ supported or allowed for this file or process, even though the
+ operation was invoked correctly. */
static bool
is_CLONENOTSUP (int err)
@@ -1178,16 +1179,15 @@ fd_has_acl (int fd)
Return FALSE if it's a terminal failure for this file. */
static bool
-handle_clone_fail (int dst_dirfd, char const* dst_relname,
- char const* src_name, char const* dst_name,
+handle_clone_fail (int dst_dirfd, char const *dst_relname,
+ char const *src_name, char const *dst_name,
int dest_desc, bool new_dst, enum Reflink_type reflink_mode)
{
/* When the clone operation fails, report failure only with errno values
known to mean trouble when the clone is supported and called properly.
Do not report failure merely because !is_CLONENOTSUP (errno),
- as systems may yield oddball errno values here with FICLONE.
- Also is_CLONENOTSUP() is not appropriate for the range of errnos
- possible from fclonefileat(), so it's more consistent to avoid. */
+ as systems may yield oddball errno values here with FICLONE,
+ and is_CLONENOTSUP is not appropriate for fclonefileat. */
bool report_failure = is_terminal_error (errno);
if (reflink_mode == REFLINK_ALWAYS || report_failure)