X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/3b17384631b95be73f69dd3a712009a5792c0f3c..535737bf39acb48354871d0d55e86d2ac580f0f7:/flist.c?ds=sidebyside diff --git a/flist.c b/flist.c index 9654bd72..64b0c23c 100644 --- a/flist.c +++ b/flist.c @@ -569,6 +569,9 @@ static struct file_struct *receive_file_entry(struct file_list *flist, if (!(flags & XMIT_SAME_MODE)) mode = from_wire_mode(read_int(f)); + if (chmod_modes && !S_ISLNK(mode)) + mode = tweak_mode(mode, chmod_modes); + if (preserve_uid && !(flags & XMIT_SAME_UID)) uid = (uid_t)read_int(f); if (preserve_gid && !(flags & XMIT_SAME_GID)) @@ -806,9 +809,14 @@ struct file_struct *make_file(char *fname, struct file_list *flist, * into a mount-point directory, not to avoid copying a symlinked * file if -L (or similar) was specified. */ if (one_file_system && st.st_dev != filesystem_dev - && S_ISDIR(st.st_mode)) { - if (one_file_system > 1) + && S_ISDIR(st.st_mode)) { + if (one_file_system > 1) { + if (verbose > 2) { + rprintf(FINFO, "skipping mount-point dir %s\n", + thisname); + } return NULL; + } flags |= FLAG_MOUNT_POINT; } @@ -870,10 +878,7 @@ struct file_struct *make_file(char *fname, struct file_list *flist, file->flags = flags; file->modtime = st.st_mtime; file->length = st.st_size; - if (chmod_modes && am_sender && (S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))) - file->mode = tweak_mode(st.st_mode, chmod_modes); - else - file->mode = st.st_mode; + file->mode = st.st_mode; file->uid = st.st_uid; file->gid = st.st_gid; @@ -936,7 +941,7 @@ struct file_struct *make_file(char *fname, struct file_list *flist, if (keep_dirlinks && linkname_len && flist) { STRUCT_STAT st2; int save_mode = file->mode; - file->mode = S_IFDIR; /* find a directory w/our name */ + file->mode = S_IFDIR; /* Find a directory with our name. */ if (flist_find(the_file_list, file) >= 0 && do_stat(thisname, &st2) == 0 && S_ISDIR(st2.st_mode)) { file->modtime = st2.st_mtime; @@ -966,6 +971,9 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, if (!file) return NULL; + if (chmod_modes && !S_ISLNK(file->mode)) + file->mode = tweak_mode(file->mode, chmod_modes); + maybe_emit_filelist_progress(flist->count + flist_count_offset); flist_expand(flist);