1
1

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>
Этот коммит содержится в:
Slava Zanko 2009-06-23 11:23:19 +03:00
родитель ce129506f6
Коммит f37120e8fc

Просмотреть файл

@ -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))) { while (mc_chmod (dst_path, (src_mode & ctx->umask_kill))) {
temp_status = file_error ( temp_status = file_error (
_(" Cannot chmod target file \"%s\" \n %s "), dst_path); _(" 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); 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.actime = cbuf.st_atime;
utb.modtime = cbuf.st_mtime; utb.modtime = cbuf.st_mtime;
mc_utime (dest_dir, &utb); 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: ret: