From: Slack Date: Sun, 25 Nov 2012 09:39:44 +0000 (+0400) Subject: Ticket #2924: attributes of existing directories are never preserved. X-Git-Tag: 4.8.7~14^2~2 X-Git-Url: https://repo.or.cz/w/midnight-commander.git/commitdiff_plain/82cfece6aeeefc738b7a638181cac0ab142e0088 Ticket #2924: attributes of existing directories are never preserved. If superuser copies a directory tree (e.g. from a safe backup location (with sane permission, owner, group, timestamp) over an existing tree, any attributes are not preserved. All destination dirs retain all their existing attributes instead of change attributes from source. Signed-off-by: Andrew Borodin --- diff --git a/src/filemanager/file.c b/src/filemanager/file.c index 2586a401c..7d0cdfb58 100644 --- a/src/filemanager/file.c +++ b/src/filemanager/file.c @@ -2066,6 +2066,7 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con { dest_dir = d; d = NULL; + dest_dir_vpath = vfs_path_from_str (dest_dir); goto dont_mkdir; } } @@ -2091,6 +2092,7 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con lp->dev = buf.st_dev; dest_dirs = g_slist_prepend (dest_dirs, lp); + dont_mkdir: if (ctx->preserve_uidgid) { while (mc_chown (dest_dir_vpath, cbuf.st_uid, cbuf.st_gid) != 0) @@ -2109,7 +2111,6 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con } } - dont_mkdir: /* open the source dir for reading */ reading = mc_opendir (src_vpath); if (reading == NULL)