- } else {
- set_perms(fname, file, NULL,
- ok_to_set_time ? 0 : PERMS_SKIP_MTIME);
+ return;
+ }
+ if (ret == 0) {
+ /* The file was moved into place (not copied), so it's done. */
+ return;
+ }
+ /* The file was copied, so tweak the perms of the copied file. If it
+ * was copied to partialptr, move it into its final destination. */
+ fnametmp = partialptr ? partialptr : fname;
+
+ do_set_file_attrs:
+ set_file_attrs(fnametmp, file, NULL, fnamecmp,
+ ok_to_set_time ? 0 : ATTRS_SKIP_MTIME);
+
+ if (partialptr) {
+ if (do_rename(fnametmp, fname) < 0) {
+ rsyserr(FERROR, errno, "rename %s -> \"%s\"",
+ full_fname(fnametmp), fname);
+ } else
+ handle_partial_dir(partialptr, PDIR_DELETE);
+ }
+}
+
+struct file_list *flist_for_ndx(int ndx)
+{
+ struct file_list *flist = cur_flist;
+
+ if (!flist && !(flist = first_flist))
+ return NULL;
+
+ while (ndx < flist->ndx_start-1) {
+ if (flist == first_flist)
+ return NULL;
+ flist = flist->prev;
+ }
+ while (ndx > flist->ndx_end) {
+ if (!(flist = flist->next))
+ return NULL;