+ if (!(flist = flist_for_ndx(ndx))) {
+ rprintf(FERROR,
+ "INTERNAL ERROR: unable to find flist for item %d\n",
+ ndx);
+ return;
+ }
+
+ file = flist->files[ndx - flist->ndx_start];
+ if (!push_pathname(F_PATHNAME(file), -1))
+ return;
+ f_name(file, fname);
+
+ if (do_unlink(fname) == 0) {
+ if (verbose > 1)
+ rprintf(FINFO, "sender removed %s\n", fname);
+ } else
+ rsyserr(FERROR, errno, "sender failed to remove %s", fname);
+}
+
+static void write_ndx_and_attrs(int f_out, int ndx, int iflags,
+ const char *fname, struct file_struct *file,
+ uchar fnamecmp_type, char *buf, int len)
+{
+ write_ndx(f_out, ndx);
+ if (protocol_version < 29)
+ return;
+ write_shortint(f_out, iflags);
+ if (iflags & ITEM_BASIS_TYPE_FOLLOWS)
+ write_byte(f_out, fnamecmp_type);
+ if (iflags & ITEM_XNAME_FOLLOWS)
+ write_vstring(f_out, buf, len);
+#ifdef SUPPORT_XATTRS
+ if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && !dry_run)
+ send_xattr_request(fname, file, f_out);
+#endif
+}
+
+void send_files(int f_in, int f_out)