csomh / rpms / rsync

Forked from rpms/rsync 3 years ago
Clone

Blame SOURCES/rsync-3.0.9-ineffective-owner.patch

63c345
--- a/rsync.c
63c345
+++ b/rsync.c
63c345
@@ -418,31 +418,6 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
63c345
 		get_acl(fname, sxp);
63c345
 #endif
63c345
 
63c345
-#ifdef SUPPORT_XATTRS
63c345
-	if (am_root < 0)
63c345
-		set_stat_xattr(fname, file, new_mode);
63c345
-	if (preserve_xattrs && fnamecmp)
63c345
-		set_xattr(fname, file, fnamecmp, sxp);
63c345
-#endif
63c345
-
63c345
-	if (!preserve_times
63c345
-	 || (!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode))
63c345
-	 || (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode)))
63c345
-		flags |= ATTRS_SKIP_MTIME;
63c345
-	if (!(flags & ATTRS_SKIP_MTIME)
63c345
-	    && cmp_time(sxp->st.st_mtime, file->modtime) != 0) {
63c345
-		int ret = set_modtime(fname, file->modtime, sxp->st.st_mode);
63c345
-		if (ret < 0) {
63c345
-			rsyserr(FERROR_XFER, errno, "failed to set times on %s",
63c345
-				full_fname(fname));
63c345
-			goto cleanup;
63c345
-		}
63c345
-		if (ret == 0) /* ret == 1 if symlink could not be set */
63c345
-			updated = 1;
63c345
-		else
63c345
-			file->flags |= FLAG_TIME_FAILED;
63c345
-	}
63c345
-
63c345
 	change_uid = am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file);
63c345
 	change_gid = gid_ndx && !(file->flags & FLAG_SKIP_GROUP)
63c345
 		  && sxp->st.st_gid != (gid_t)F_GROUP(file);
63c345
@@ -490,6 +465,31 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
63c345
 		updated = 1;
63c345
 	}
63c345
 
63c345
+#ifdef SUPPORT_XATTRS
63c345
+	if (am_root < 0)
63c345
+		set_stat_xattr(fname, file, new_mode);
63c345
+	if (preserve_xattrs && fnamecmp)
63c345
+		set_xattr(fname, file, fnamecmp, sxp);
63c345
+#endif
63c345
+
63c345
+	if (!preserve_times
63c345
+	 || (!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode))
63c345
+	 || (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode)))
63c345
+		flags |= ATTRS_SKIP_MTIME;
63c345
+	if (!(flags & ATTRS_SKIP_MTIME)
63c345
+	    && cmp_time(sxp->st.st_mtime, file->modtime) != 0) {
63c345
+		int ret = set_modtime(fname, file->modtime, sxp->st.st_mode);
63c345
+		if (ret < 0) {
63c345
+			rsyserr(FERROR_XFER, errno, "failed to set times on %s",
63c345
+				full_fname(fname));
63c345
+			goto cleanup;
63c345
+		}
63c345
+		if (ret == 0) /* ret == 1 if symlink could not be set */
63c345
+			updated = 1;
63c345
+		else
63c345
+			file->flags |= FLAG_TIME_FAILED;
63c345
+	}
63c345
+
63c345
 #ifdef SUPPORT_ACLS
63c345
 	/* It's OK to call set_acl() now, even for a dir, as the generator
63c345
 	 * will enable owner-writability using chmod, if necessary.