summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-05-23 23:23:55 +0000
committerJim Meyering <jim@meyering.net>1999-05-23 23:23:55 +0000
commit0e39b529b6039e95beea3db4fd2897303a59b781 (patch)
treec2945f03f01dd4bdd3f981df61884593700f2333
parent3957028d28ad80f8aba451c4ea17e6ded3d1c27a (diff)
downloadcoreutils-0e39b529b6039e95beea3db4fd2897303a59b781.tar.xz
(copy_internal): Don't apply the umask in move_mode.
Otherwise, `mv' would not preserve the permissions when copying between partitions. Reported by David Godfrey
-rw-r--r--src/copy.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/copy.c b/src/copy.c
index 1a6694ebb..f1242efea 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -896,7 +896,13 @@ copy_internal (const char *src_path, const char *dst_path,
else if ((x->preserve_chmod_bits || new_dst)
&& (x->copy_as_regular || S_ISREG (src_type) || S_ISDIR (src_type)))
{
- if (chmod (dst_path, src_mode & x->umask_kill))
+ mode_t dst_mode = src_mode;
+
+ /* Honor the umask for `cp', but not for `mv'. */
+ if (!x->move_mode)
+ dst_mode &= x->umask_kill;
+
+ if (chmod (dst_path, dst_mode))
{
error (0, errno, _("preserving permissions for %s"), dst_path);
if (x->require_preserve)