summaryrefslogtreecommitdiff
path: root/bin/cp
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2013-01-27 05:59:28 +0000
committerMark Johnston <markj@FreeBSD.org>2013-01-27 05:59:28 +0000
commit111a5d7c788a38cdf98baf61fae5af5aa1aaf150 (patch)
treee5c3cd7dd8071774f29c9c3ff8a90453c7e5fb04 /bin/cp
parentc2b51d4457560eed58e28bcc230e42722aa01a4f (diff)
downloadsrc-test2-111a5d7c788a38cdf98baf61fae5af5aa1aaf150.tar.gz
src-test2-111a5d7c788a38cdf98baf61fae5af5aa1aaf150.zip
Notes
Diffstat (limited to 'bin/cp')
-rw-r--r--bin/cp/utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/cp/utils.c b/bin/cp/utils.c
index aa424f846286..ad9695c08a13 100644
--- a/bin/cp/utils.c
+++ b/bin/cp/utils.c
@@ -266,6 +266,11 @@ copy_link(const FTSENT *p, int exists)
int len;
char llink[PATH_MAX];
+ if (exists && nflag) {
+ if (vflag)
+ printf("%s not overwritten\n", to.p_path);
+ return (1);
+ }
if ((len = readlink(p->fts_path, llink, sizeof(llink) - 1)) == -1) {
warn("readlink: %s", p->fts_path);
return (1);
@@ -285,6 +290,12 @@ copy_link(const FTSENT *p, int exists)
int
copy_fifo(struct stat *from_stat, int exists)
{
+
+ if (exists && nflag) {
+ if (vflag)
+ printf("%s not overwritten\n", to.p_path);
+ return (1);
+ }
if (exists && unlink(to.p_path)) {
warn("unlink: %s", to.p_path);
return (1);
@@ -299,6 +310,12 @@ copy_fifo(struct stat *from_stat, int exists)
int
copy_special(struct stat *from_stat, int exists)
{
+
+ if (exists && nflag) {
+ if (vflag)
+ printf("%s not overwritten\n", to.p_path);
+ return (1);
+ }
if (exists && unlink(to.p_path)) {
warn("unlink: %s", to.p_path);
return (1);