extern int preserve_hard_links;
extern int preserve_perms;
extern int preserve_times;
-extern int omit_dir_times;
extern int uid_ndx;
extern int gid_ndx;
extern int delete_mode;
{
if (statret >= 0) { /* A from-dest-dir statret can == 1! */
int keep_time = !preserve_times ? 0
- : S_ISDIR(file->mode) ? !omit_dir_times
+ : S_ISDIR(file->mode) ? preserve_times > 1
: !S_ISLNK(file->mode);
if (S_ISREG(file->mode) && F_LENGTH(file) != sxp->st.st_size)
if (!hard_link_one(file, fname, cmpbuf, 1))
goto try_a_copy;
if (preserve_hard_links && F_IS_HLINKED(file))
- finish_hard_link(file, fname, &sxp->st, itemizing, code, j);
+ finish_hard_link(file, fname, ndx, &sxp->st, itemizing, code, j);
if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) {
itemize(cmpbuf, file, ndx, 1, sxp,
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
}
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
- finish_hard_link(file, fname, &sxp->st, itemizing, code, -1);
+ finish_hard_link(file, fname, ndx, &sxp->st, itemizing, code, -1);
#endif
return -2;
}
return j;
}
if (preserve_hard_links && F_IS_HLINKED(file))
- finish_hard_link(file, fname, NULL, itemizing, code, -1);
+ finish_hard_link(file, fname, ndx, NULL, itemizing, code, -1);
} else
#endif
match_level = 2;
itemize(fname, file, ndx, 0, &sx, 0, 0, NULL);
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
- finish_hard_link(file, fname, &sx.st, itemizing, code, -1);
+ finish_hard_link(file, fname, ndx, &sx.st, itemizing, code, -1);
#endif
if (remove_source_files == 1)
goto return_with_success;
statret = 1;
}
#ifdef SUPPORT_HARD_LINKS
- if (preserve_hard_links && F_HLINK_NOT_LAST(file))
+ if (preserve_hard_links && F_HLINK_NOT_LAST(file)) {
+ cur_flist->in_progress++;
goto cleanup;
+ }
#endif
if (do_symlink(sl, fname) != 0) {
rsyserr(FERROR, errno, "symlink %s -> \"%s\" failed",
rprintf(code, "%s -> %s\n", fname, sl);
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
- finish_hard_link(file, fname, NULL, itemizing, code, -1);
+ finish_hard_link(file, fname, ndx, NULL, itemizing, code, -1);
#endif
/* This does not check remove_source_files == 1
* because this is one of the items that the old
itemize(fname, file, ndx, 0, &sx, 0, 0, NULL);
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
- finish_hard_link(file, fname, &sx.st, itemizing, code, -1);
+ finish_hard_link(file, fname, ndx, &sx.st, itemizing, code, -1);
#endif
if (remove_source_files == 1)
goto return_with_success;
statret = 1;
}
#ifdef SUPPORT_HARD_LINKS
- if (preserve_hard_links && F_HLINK_NOT_LAST(file))
+ if (preserve_hard_links && F_HLINK_NOT_LAST(file)) {
+ cur_flist->in_progress++;
goto cleanup;
+ }
#endif
if (verbose > 2) {
rprintf(FINFO, "mknod(%s, 0%o, [%ld,%ld])\n",
rprintf(code, "%s\n", fname);
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
- finish_hard_link(file, fname, NULL, itemizing, code, -1);
+ finish_hard_link(file, fname, ndx, NULL, itemizing, code, -1);
#endif
if (remove_source_files == 1)
goto return_with_success;
if (statret != 0) {
#ifdef SUPPORT_HARD_LINKS
- if (preserve_hard_links && F_HLINK_NOT_LAST(file))
+ if (preserve_hard_links && F_HLINK_NOT_LAST(file)) {
+ cur_flist->in_progress++;
goto cleanup;
+ }
#endif
if (stat_errno == ENOENT)
goto notify_others;
goto cleanup;
}
- if (append_mode > 0 && sx.st.st_size > F_LENGTH(file))
+ if (append_mode > 0 && sx.st.st_size >= F_LENGTH(file))
goto cleanup;
if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
itemize(fnamecmp, file, ndx, statret, &sx, 0, 0, NULL);
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
- finish_hard_link(file, fname, &sx.st, itemizing, code, -1);
+ finish_hard_link(file, fname, ndx, &sx.st, itemizing, code, -1);
#endif
if (remove_source_files != 1)
goto cleanup;
pretend_missing:
/* pretend the file didn't exist */
#ifdef SUPPORT_HARD_LINKS
- if (preserve_hard_links && F_HLINK_NOT_LAST(file))
+ if (preserve_hard_links && F_HLINK_NOT_LAST(file)) {
+ cur_flist->in_progress++;
goto cleanup;
+ }
#endif
statret = real_ret = -1;
goto notify_others;
if (!do_xfers) {
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
- finish_hard_link(file, fname, &sx.st, itemizing, code, -1);
+ finish_hard_link(file, fname, ndx, &sx.st, itemizing, code, -1);
#endif
goto cleanup;
}
* transfer and/or re-set any tweaked modified-time values. */
for (i = start; i <= end; i++, counter++) {
file = flist->files[i];
+ if (!S_ISDIR(file->mode))
+ continue;
if (verbose > 3) {
fname = f_name(file, NULL);
rprintf(FINFO, "touch_up_dirs: %s (%d)\n",
NS(fname), i);
}
- if (!F_IS_ACTIVE(file) || !S_ISDIR(file->mode)
- || file->flags & FLAG_MISSING_DIR)
- continue;
- if (!need_retouch_dir_times && file->mode & S_IWUSR)
+ if (!F_IS_ACTIVE(file) || file->flags & FLAG_MISSING_DIR
+ || (!need_retouch_dir_times && file->mode & S_IWUSR))
continue;
fname = f_name(file, NULL);
if (!(file->mode & S_IWUSR))
while (preserve_hard_links && (ndx = get_hlink_num()) != -1) {
flist = flist_for_ndx(ndx);
assert(flist != NULL);
- file = flist->files[ndx];
+ file = flist->files[ndx - flist->ndx_start];
assert(file->flags & FLAG_HLINKED);
- finish_hard_link(file, f_name(file, fbuf), NULL, itemizing, code, -1);
+ finish_hard_link(file, f_name(file, fbuf), ndx, NULL, itemizing, code, -1);
}
#endif
}
solo_file = local_name;
dir_tweaking = !(list_only || solo_file || dry_run);
- need_retouch_dir_times = preserve_times && !omit_dir_times;
+ need_retouch_dir_times = preserve_times > 1;
lull_mod = allowed_lull * 5;
if (verbose > 2)
dflt_perms = (ACCESSPERMS & ~orig_umask);
do {
+#ifdef SUPPORT_HARD_LINKS
+ if (preserve_hard_links && inc_recurse) {
+ while (!flist_eof && file_total < FILECNT_LOOKAHEAD/2)
+ wait_for_receiver();
+ }
+#endif
+
if (inc_recurse && cur_flist->ndx_start) {
struct file_struct *fp = dir_flist->files[cur_flist->parent_ndx];
f_name(fp, fbuf);