diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-04-17 01:36:22 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-04-17 02:03:21 +0000 |
| commit | 64d6925d1901637125f9f739282e72c992657dc8 (patch) | |
| tree | 2eb058578ffb59e45b8552fd804e5c39a2083245 /bin/cp | |
| parent | 2e850b832f5d2adb9b230d191277d67c00caaab9 (diff) | |
Diffstat (limited to 'bin/cp')
| -rw-r--r-- | bin/cp/cp.c | 10 |
1 files 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; } |
