From: Paul Eggert Date: Fri, 8 Sep 2023 23:25:00 +0000 (-0700) Subject: cp,mv,install: add copy_internal comment X-Git-Tag: v9.5~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7ec75a27687bc30627e70c9f14d80de778a0d85;p=thirdparty%2Fcoreutils.git cp,mv,install: add copy_internal comment * src/copy.c (copy_internal): Add comment about some particularly tricky logic. --- diff --git a/src/copy.c b/src/copy.c index 0c2004c7b0..e9924fb499 100644 --- a/src/copy.c +++ b/src/copy.c @@ -2292,6 +2292,13 @@ copy_internal (char const *src_name, char const *dst_name, if (! new_dst) { + /* Normally, fill in DST_SB or set NEW_DST so that later code + can use DST_SB if NEW_DST is false. However, don't bother + doing this when rename_errno == EEXIST and X->interactive is + I_ALWAYS_NO or I_ALWAYS_SKIP, something that can happen only + with mv in which case x->update must be false which means + that even if !NEW_DST the move will be abandoned without + looking at DST_SB. */ if (! (rename_errno == EEXIST && (x->interactive == I_ALWAYS_NO || x->interactive == I_ALWAYS_SKIP)))