X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/cae7885e2f5991640bd6a7b117147b2bc0e30bec..236adddc18cd4f0e3d91183220af10c11c5cc8a2:/generator.c diff --git a/generator.c b/generator.c index b22d9d64..f4f15bb8 100644 --- a/generator.c +++ b/generator.c @@ -27,6 +27,7 @@ extern int dry_run; extern int do_xfers; extern int stdout_format_has_i; extern int logfile_format_has_i; +extern int receiver_symlink_times; extern int am_root; extern int am_server; extern int am_daemon; @@ -41,6 +42,7 @@ extern int preserve_links; extern int preserve_devices; extern int preserve_specials; extern int preserve_hard_links; +extern int preserve_executability; extern int preserve_perms; extern int preserve_times; extern int uid_ndx; @@ -552,7 +554,7 @@ static void do_delete_pass(void) int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp) { -#ifndef HAVE_LUTIMES +#if !defined HAVE_LUTIMES || !defined HAVE_UTIMES if (S_ISLNK(file->mode)) { ; } else @@ -563,6 +565,9 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp) if (preserve_perms && !BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS)) return 0; + if (preserve_executability && ((sxp->st.st_mode & 0111 ? 1 : 0) ^ (file->mode & 0111 ? 1 : 0))) + return 0; + if (am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file)) return 0; @@ -595,8 +600,11 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre { if (statret >= 0) { /* A from-dest-dir statret can == 1! */ int keep_time = !preserve_times ? 0 - : S_ISDIR(file->mode) ? preserve_times > 1 - : !S_ISLNK(file->mode); + : S_ISDIR(file->mode) ? preserve_times > 1 : +#if defined HAVE_LUTIMES && defined HAVE_UTIMES + (receiver_symlink_times && !(file->flags & FLAG_TIME_FAILED)) || +#endif + !S_ISLNK(file->mode); if (S_ISREG(file->mode) && F_LENGTH(file) != sxp->st.st_size) iflags |= ITEM_REPORT_SIZE; @@ -610,7 +618,8 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre ; } else #endif - if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS)) + if ((preserve_perms || preserve_executability) + && !BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS)) iflags |= ITEM_REPORT_PERMS; if (uid_ndx && am_root && (uid_t)F_OWNER(file) != sxp->st.st_uid) iflags |= ITEM_REPORT_OWNER; @@ -960,7 +969,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx, goto try_a_copy; if (preserve_hard_links && F_IS_HLINKED(file)) finish_hard_link(file, fname, ndx, &sxp->st, itemizing, code, j); - if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) { + if (!maybe_ATTRS_REPORT && (verbose > 1 || stdout_format_has_i > 1)) { itemize(cmpbuf, file, ndx, 1, sxp, ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0, "");