X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/3f30927214317034727e11218aff0bd6d686bdf5..ce055e863de711efc559b4909e2f71be8a093a02:/flist.c diff --git a/flist.c b/flist.c index 707edfd0..afb1836b 100644 --- a/flist.c +++ b/flist.c @@ -335,7 +335,9 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_ { static time_t modtime; static mode_t mode; +#ifdef SUPPORT_HARD_LINKS static int64 dev; +#endif static dev_t rdev; static uint32 rdev_major; static uid_t uid; @@ -599,7 +601,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist, { static int64 modtime; static mode_t mode; +#ifdef SUPPORT_HARD_LINKS static int64 dev; +#endif static dev_t rdev; static uint32 rdev_major; static uid_t uid; @@ -1054,20 +1058,18 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, /* -x only affects dirs because we need to avoid recursing * into a mount-point directory, not to avoid copying a * symlinked file if -L (or similar) was specified. */ - if (one_file_system && flags & FLAG_CONTENT_DIR) { - if (flags & FLAG_TOP_DIR) - filesystem_dev = st.st_dev; - else if (st.st_dev != filesystem_dev) { - if (one_file_system > 1) { - if (verbose > 1) { - rprintf(FINFO, - "[%s] skipping mount-point dir %s\n", - who_am_i(), thisname); - } - return NULL; + if (one_file_system && st.st_dev != filesystem_dev + && BITS_SETnUNSET(flags, FLAG_CONTENT_DIR, FLAG_TOP_DIR)) { + if (one_file_system > 1) { + if (verbose > 1) { + rprintf(FINFO, + "[%s] skipping mount-point dir %s\n", + who_am_i(), thisname); } - flags |= FLAG_MOUNT_DIR; + return NULL; } + flags |= FLAG_MOUNT_DIR; + flags &= ~FLAG_CONTENT_DIR; } } else flags &= ~FLAG_CONTENT_DIR; @@ -1586,8 +1588,19 @@ static void send1extra(int f, struct file_struct *file, struct file_list *flist) change_local_filter_dir(fbuf, dlen, send_dir_depth); - if (BITS_SETnUNSET(file->flags, FLAG_CONTENT_DIR, FLAG_MOUNT_DIR)) + if (file->flags & FLAG_CONTENT_DIR) { + if (one_file_system) { + STRUCT_STAT st; + if (link_stat(fbuf, &st, copy_dirlinks) != 0) { + io_error |= IOERR_GENERAL; + rsyserr(FERROR, errno, "link_stat %s failed", + full_fname(fbuf)); + return; + } + filesystem_dev = st.st_dev; + } send_directory(f, flist, fbuf, dlen, flags); + } if (!relative_paths) return; @@ -1948,6 +1961,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) send_implied_dirs(f, flist, fbuf, slash, p, flags, 0); } + if (one_file_system) + filesystem_dev = st.st_dev; + if (recurse || (xfer_dirs && is_dot_dir)) { struct file_struct *file; int top_flags = FLAG_TOP_DIR | FLAG_CONTENT_DIR | flags;