- set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT);
+ if (may_tweak(&sx.st)) {
+ /* Currently, we call set_file_attrs on all tweakable
+ * files, though ideally it would have no effect when
+ * unchanged_attrs returns true. */
+ if (verbose > 2)
+ rprintf(FINFO, "possibly tweaking attributes of %s\n", fname);
+ set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT);
+ } else if (!unchanged_attrs(fname, file, &sx)) {
+ /* Need to recreate the file.
+ * copy_altdest_file sets its attributes, etc. */
+ if (verbose > 2)
+ rprintf(FINFO, "recreating %s due to changed attributes\n", fname);
+ if (!dry_run && copy_altdest_file(fnamecmp, fname, file))
+ goto cleanup;
+ iflags |= ITEM_LOCAL_CHANGE;
+ }