mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Copy files/dirs: If 'Preserve attributes' checkbox is unchecked, then permissions of files and dirs will be set relative to current umask
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
ce129506f6
commit
f37120e8fc
14
src/file.c
14
src/file.c
@ -732,7 +732,8 @@ copy_file_file (FileOpContext *ctx, const char *src_path, const char *dst_path,
|
||||
}
|
||||
}
|
||||
|
||||
if (!appending && ctx->preserve) {
|
||||
if (!appending) {
|
||||
if (ctx->preserve){
|
||||
while (mc_chmod (dst_path, (src_mode & ctx->umask_kill))) {
|
||||
temp_status = file_error (
|
||||
_(" Cannot chmod target file \"%s\" \n %s "), dst_path);
|
||||
@ -742,6 +743,12 @@ copy_file_file (FileOpContext *ctx, const char *src_path, const char *dst_path,
|
||||
}
|
||||
}
|
||||
mc_utime (dst_path, &utb);
|
||||
} else {
|
||||
src_mode = umask(-1);
|
||||
umask(src_mode);
|
||||
src_mode = 0100666 & ~src_mode;
|
||||
mc_chmod (dst_path, (src_mode & ctx->umask_kill));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -954,6 +961,11 @@ copy_dir_dir (FileOpContext *ctx, const char *s, const char *_d, int toplevel,
|
||||
utb.actime = cbuf.st_atime;
|
||||
utb.modtime = cbuf.st_mtime;
|
||||
mc_utime (dest_dir, &utb);
|
||||
} else {
|
||||
cbuf.st_mode = umask(-1);
|
||||
umask(cbuf.st_mode);
|
||||
cbuf.st_mode = 0100777 & ~cbuf.st_mode;
|
||||
mc_chmod (dest_dir, cbuf.st_mode & ctx->umask_kill);
|
||||
}
|
||||
|
||||
ret:
|
||||
|
Loading…
Reference in New Issue
Block a user