---
 generator.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/generator.c b/generator.c
index 8038feb..4abe6a0 100644
--- a/generator.c
+++ b/generator.c
@@ -1892,6 +1892,7 @@ static void touch_up_dirs(struct file_list *flist, int 
ndx)
        static int counter = 0;
        struct file_struct *file;
        char *fname;
+       BOOL retouch_perms;
        int i, start, end;
 
        if (ndx < 0) {
@@ -1912,11 +1913,13 @@ static void touch_up_dirs(struct file_list *flist, int 
ndx)
                        rprintf(FINFO, "touch_up_dirs: %s (%d)\n",
                                NS(fname), i);
                }
+               /* Be sure not to retouch permissions with --fake-super. */
+               retouch_perms = !am_root && !(file->mode & S_IWUSR);
                if (!F_IS_ACTIVE(file) || file->flags & FLAG_MISSING_DIR
-                || (!need_retouch_dir_times && file->mode & S_IWUSR))
+                || !(need_retouch_dir_times || retouch_perms))
                        continue;
                fname = f_name(file, NULL);
-               if (!(file->mode & S_IWUSR))
+               if (retouch_perms)
                        do_chmod(fname, file->mode);
                if (need_retouch_dir_times) {
                        STRUCT_STAT st;
-- 
1.6.5.3.154.gbd911



-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to