projects
/
platform
/
upstream
/
coreutils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a49513b
)
(copy_internal): Don't allow cp (or mv, when working
author
Jim Meyering
<jim@meyering.net>
Wed, 10 Jan 2001 09:43:36 +0000
(09:43 +0000)
committer
Jim Meyering
<jim@meyering.net>
Wed, 10 Jan 2001 09:43:36 +0000
(09:43 +0000)
across a partition boundary) to overwrite a non-directory with a directory.
src/copy.c
patch
|
blob
|
history
diff --git
a/src/copy.c
b/src/copy.c
index
734271b
..
c7a5b72
100644
(file)
--- a/
src/copy.c
+++ b/
src/copy.c
@@
-628,6
+628,14
@@
copy_internal (const char *src_path, const char *dst_path,
return 1;
}
+ if (S_ISDIR (src_type) && !S_ISDIR (dst_sb.st_mode))
+ {
+ error (0, 0,
+ _("cannot overwrite non-directory %s with directory %s"),
+ quote_n (0, dst_path), quote_n (1, src_path));
+ return 1;
+ }
+
if (!S_ISDIR (src_type))
{
if (S_ISDIR (dst_sb.st_mode))