Another small improvement to the --one-file-system option.
[rsync/rsync.git] / flist.c
diff --git a/flist.c b/flist.c
index 8f4e182..c6b1a72 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -569,7 +569,7 @@ 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_ISREG(mode) || S_ISDIR(mode)))
+       if (chmod_modes && !S_ISLNK(mode))
                mode = tweak_mode(mode, chmod_modes);
 
        if (preserve_uid && !(flags & XMIT_SAME_UID))
@@ -647,13 +647,14 @@ static struct file_struct *receive_file_entry(struct file_list *flist,
                        in_del_hier = recurse;
                        del_hier_name_len = file->dir.depth == 0 ? 0 : l1 + l2;
                        if (relative_paths && del_hier_name_len > 2
-                           && basename_len == 1+1 && *basename == '.')
+                           && lastname[del_hier_name_len-1] == '.'
+                           && lastname[del_hier_name_len-2] == '/')
                                del_hier_name_len -= 2;
                        file->flags |= FLAG_TOP_DIR | FLAG_DEL_HERE;
                } else if (in_del_hier) {
                        if (!relative_paths || !del_hier_name_len
                         || (l1 >= del_hier_name_len
-                         && thisname[del_hier_name_len] == '/'))
+                         && lastname[del_hier_name_len] == '/'))
                                file->flags |= FLAG_DEL_HERE;
                        else
                                in_del_hier = 0;
@@ -809,9 +810,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;
        }
 
@@ -966,7 +972,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
        if (!file)
                return NULL;
 
-       if (chmod_modes && (S_ISREG(file->mode) || S_ISDIR(file->mode)))
+       if (chmod_modes && !S_ISLNK(file->mode))
                file->mode = tweak_mode(file->mode, chmod_modes);
 
        maybe_emit_filelist_progress(flist->count + flist_count_offset);