- if (file->basedir) {
- /* N.B. We're sure that this fits, so offset is OK. */
- offset = strlcpy(fname, file->basedir, sizeof fname);
- if (!offset || fname[offset-1] != '/')
- fname[offset++] = '/';
- } else
- offset = 0;
- fname2 = f_name_to(file, fname + offset);
+ if (!(iflags & ITEM_TRANSFER)) {
+ maybe_log_item(file, iflags, itemizing, xname);
+ write_ndx_and_attrs(f_out, ndx, iflags, fname, file,
+ fnamecmp_type, xname, xlen);
+ continue;
+ }
+ if (phase == 2) {
+ rprintf(FERROR,
+ "got transfer request in phase 2 [%s]\n",
+ who_am_i());
+ exit_cleanup(RERR_PROTOCOL);
+ }
+
+ if (file->flags & FLAG_FILE_SENT) {
+ if (csum_length == SHORT_SUM_LENGTH) {
+ /* For inplace: redo phase turns off the backup
+ * flag so that we do a regular inplace send. */
+ make_backups = -make_backups;
+ append_mode = -append_mode;
+ csum_length = SUM_LENGTH;
+ }
+ } else {
+ if (csum_length != SHORT_SUM_LENGTH) {
+ make_backups = -make_backups;
+ append_mode = -append_mode;
+ csum_length = SHORT_SUM_LENGTH;
+ }
+ }
+
+ updating_basis_file = inplace && (protocol_version >= 29
+ ? fnamecmp_type == FNAMECMP_FNAME : make_backups <= 0);