diff options
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/cp.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c index bba54809..a843b90a 100644 --- a/toys/posix/cp.c +++ b/toys/posix/cp.c @@ -410,11 +410,10 @@ void cp_main(void) } if (destdir) { - char *s = FLAG(D) ? getdirname(src) : getbasename(src); + char *s = FLAG(D) ? dirname(src) : getbasename(src); TT.destname = xmprintf("%s/%s", destname, s); if (FLAG(D)) { - free(s); if (!(s = fileunderdir(TT.destname, destname))) { error_msg("%s not under %s", TT.destname, destname); continue; |