summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cp.c b/src/cp.c
index 74b7c2d96..d61ed5803 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -520,7 +520,9 @@ do_copy (int argc, char **argv)
/* When the destination is specified with a trailing slash and the
source exists but is not a directory, convert the user's command
- `cp source dest/' to `cp source dest/basename(source)'. */
+ `cp source dest/' to `cp source dest/basename(source)'. Doing
+ this ensures that the command `cp non-directory file/' will now
+ fail rather than performing the copy. */
else if (dest[strlen (dest) - 1] == '/'
&& lstat (source, &source_stats) == 0