Fix unwritable directory issue due to misordered chmod call.
[rsync/rsync.git] / generator.c
index d17e3b9..cd7abda 100644 (file)
@@ -549,8 +549,10 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
 #ifdef SUPPORT_XATTRS
                        if (preserve_xattrs && do_xfers
                         && iflags & (ITEM_REPORT_XATTR|ITEM_TRANSFER)) {
-                               send_xattr_request(NULL, file,
-                                       iflags & ITEM_REPORT_XATTR ? sock_f_out : -1);
+                               int fd = iflags & ITEM_REPORT_XATTR
+                                     && (protocol_version < 31 || !BITS_SET(iflags, ITEM_XNAME_FOLLOWS|ITEM_LOCAL_CHANGE))
+                                      ? sock_f_out : -1;
+                               send_xattr_request(NULL, file, fd);
                        }
 #endif
                } else if (ndx >= 0) {
@@ -1351,6 +1353,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                                goto cleanup;
                        }
                }
+
 #ifdef SUPPORT_XATTRS
                if (preserve_xattrs && statret == 1)
                        copy_xattrs(fnamecmpbuf, fname);