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 <aborodin@vmail.ru>
This commit is contained in:
Slack 2012-11-25 13:39:44 +04:00 committed by Andrew Borodin
parent 4ee4959cea
commit 82cfece6ae
1 changed files with 2 additions and 1 deletions

View File

@ -2066,6 +2066,7 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con
{ {
dest_dir = d; dest_dir = d;
d = NULL; d = NULL;
dest_dir_vpath = vfs_path_from_str (dest_dir);
goto dont_mkdir; goto dont_mkdir;
} }
} }
@ -2091,6 +2092,7 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con
lp->dev = buf.st_dev; lp->dev = buf.st_dev;
dest_dirs = g_slist_prepend (dest_dirs, lp); dest_dirs = g_slist_prepend (dest_dirs, lp);
dont_mkdir:
if (ctx->preserve_uidgid) if (ctx->preserve_uidgid)
{ {
while (mc_chown (dest_dir_vpath, cbuf.st_uid, cbuf.st_gid) != 0) 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 */ /* open the source dir for reading */
reading = mc_opendir (src_vpath); reading = mc_opendir (src_vpath);
if (reading == NULL) if (reading == NULL)