aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/cp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index f70c0501..06f1ff92 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -407,7 +407,7 @@ void cp_main(void)
if (*--trail == '/') *trail = 0;
if (destdir) {
- char *s = FLAG(D) ? dirname(src) : getbasename(src);
+ char *s = FLAG(D) ? src : getbasename(src);
TT.destname = xmprintf("%s/%s", destname, s);
if (FLAG(D)) {