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
26
src/file.c
26
src/file.c
@ -732,16 +732,23 @@ copy_file_file (FileOpContext *ctx, const char *src_path, const char *dst_path,
|
||||
}
|
||||
}
|
||||
|
||||
if (!appending && ctx->preserve) {
|
||||
while (mc_chmod (dst_path, (src_mode & ctx->umask_kill))) {
|
||||
temp_status = file_error (
|
||||
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);
|
||||
if (temp_status != FILE_RETRY) {
|
||||
return_status = temp_status;
|
||||
break;
|
||||
if (temp_status != FILE_RETRY) {
|
||||
return_status = temp_status;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
mc_utime (dst_path, &utb);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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