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,16 +732,23 @@ copy_file_file (FileOpContext *ctx, const char *src_path, const char *dst_path,
} }
} }
if (!appending && ctx->preserve) { if (!appending) {
while (mc_chmod (dst_path, (src_mode & ctx->umask_kill))) { if (ctx->preserve){
temp_status = file_error ( while (mc_chmod (dst_path, (src_mode & ctx->umask_kill))) {
temp_status = file_error (
_(" Cannot chmod target file \"%s\" \n %s "), dst_path); _(" Cannot chmod target file \"%s\" \n %s "), dst_path);
if (temp_status != FILE_RETRY) { if (temp_status != FILE_RETRY) {
return_status = temp_status; return_status = temp_status;
break; 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.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: