aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/cp.c
diff options
context:
space:
mode:
authorMartin Stjernholm <mast@google.com>2020-08-21 02:11:25 +0100
committerRob Landley <rob@landley.net>2020-08-21 17:01:05 -0500
commit050e36a10ebf91bfe8307eea7fc5156d5daf8fc9 (patch)
tree4e89a88338597235cfcbdf087036945d36e95431 /toys/posix/cp.c
parent1740f71a5b316cc6db827e7102aaa08d1e3ddeb8 (diff)
downloadtoybox-050e36a10ebf91bfe8307eea7fc5156d5daf8fc9.tar.gz
Fix cp -P to not follow symlinks.
Also fix help text to say that it is not the default.
Diffstat (limited to 'toys/posix/cp.c')
-rw-r--r--toys/posix/cp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index 06f1ff92..fd893ef4 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -38,7 +38,7 @@ config CP
-L Follow all symlinks
-l Hard link instead of copy
-n No clobber (don't overwrite DEST)
- -P Do not follow symlinks [default]
+ -P Do not follow symlinks
-p Preserve timestamps, ownership, and mode
-R Recurse into subdirectories (DEST must be a directory)
-r Synonym for -R
@@ -238,7 +238,7 @@ static int cp_node(struct dirtree *try)
// Do something _other_ than copy contents of a file?
} else if (!S_ISREG(try->st.st_mode)
- && (try->parent || (flags & (FLAG_a|FLAG_r))))
+ && (try->parent || (flags & (FLAG_a|FLAG_P|FLAG_r))))
{
int i;