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