aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix/cp.c')
-rw-r--r--toys/posix/cp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index cb7e6e3b..0e6a2efa 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -430,12 +430,11 @@ void cp_main(void)
if (rc) rc = rename(src, TT.destname);
}
- // Skip nonexistent sources
+ // Copy if we didn't mv, skipping nonexistent sources
if (rc) {
- if (errno!=EXDEV ||
- !(new = dirtree_start(src, toys.optflags&(FLAG_H|FLAG_L))))
+ if (errno!=EXDEV || dirtree_flagread(src, DIRTREE_SHUTUP+
+ DIRTREE_SYMFOLLOW*!!(toys.optflags&(FLAG_H|FLAG_L)), TT.callback))
perror_msg("bad '%s'", src);
- else dirtree_handle_callback(new, TT.callback);
}
if (destdir) free(TT.destname);
}