diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2023-12-14 16:07:04 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2023-12-14 16:07:04 +0000 |
| commit | 38509270663f336103273878cc8ddc88a225b9d8 (patch) | |
| tree | 912a10158ec93b944b27de323496cc9ed64882f1 /bin/cp | |
| parent | 0f4467ce444b201468d2268958130f495951ca3c (diff) | |
Diffstat (limited to 'bin/cp')
| -rw-r--r-- | bin/cp/utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/cp/utils.c b/bin/cp/utils.c index 891360604631..80a0c1fce824 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -145,6 +145,7 @@ copy_file(const FTSENT *entp, int dne) if (fflag) { /* remove existing destination file */ (void)unlink(to.p_path); + dne = 1; } } @@ -166,7 +167,7 @@ copy_file(const FTSENT *entp, int dne) goto done; } - if (!dne && !fflag) { + if (!dne) { /* overwrite existing destination file */ to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0); } else { |
