diff options
author | Jarno Mäkipää <jmakip87@gmail.com> | 2020-02-15 13:31:48 +0200 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2020-03-08 13:56:54 -0500 |
commit | e76aeac3cc39b404ece0f4258ed378cd74379bcd (patch) | |
tree | 1d88c5619b4b72e691c37af130f6d8c67dd9ea50 /toys/posix | |
parent | 2ec513e54cf34e86076bde871abf4f911844cef1 (diff) | |
download | toybox-e76aeac3cc39b404ece0f4258ed378cd74379bcd.tar.gz |
cp: fix -D (--parents) (REWORK MINIMAL FIX)
add: test for -D
fix: b/c/d/FILE not copying into a/ with -D option
dirname() is not needed when handling FLAG(D) since filename under
src or dest should not be changed.
github.com/landley/toybox/issues/165
Diffstat (limited to 'toys/posix')
-rw-r--r-- | toys/posix/cp.c | 2 |
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)) { |