Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Apr 2024 02:04:02 GMT
From:      Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 64d6925d1901 - main - cp: Clarify an obscure comment.
Message-ID:  <202404170204.43H242ll033878@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=64d6925d1901637125f9f739282e72c992657dc8

commit 64d6925d1901637125f9f739282e72c992657dc8
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2024-04-17 01:36:22 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-04-17 02:03:21 +0000

    cp: Clarify an obscure comment.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Reviewed by:    allanjude
    Differential Revision:  https://reviews.freebsd.org/D44805
---
 bin/cp/cp.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/bin/cp/cp.c b/bin/cp/cp.c
index cee412e57264..98697ba2b06f 100644
--- a/bin/cp/cp.c
+++ b/bin/cp/cp.c
@@ -452,13 +452,19 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat)
 
 		switch (curr->fts_statp->st_mode & S_IFMT) {
 		case S_IFLNK:
-			/* Catch special case of a non-dangling symlink. */
 			if ((fts_options & FTS_LOGICAL) ||
 			    ((fts_options & FTS_COMFOLLOW) &&
 			    curr->fts_level == 0)) {
+				/*
+				 * We asked FTS to follow links but got
+				 * here anyway, which means the target is
+				 * nonexistent or inaccessible.  Let
+				 * copy_file() deal with the error.
+				 */
 				if (copy_file(curr, dne))
 					badcp = rval = 1;
-			} else {	
+			} else {
+				/* Copy the link. */
 				if (copy_link(curr, !dne))
 					badcp = rval = 1;
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404170204.43H242ll033878>