+static void handle_delayed_updates(char *local_name)
+{
+ char *fname, *partialptr;
+ int ndx;
+
+ for (ndx = -1; (ndx = bitbag_next_bit(delayed_bits, ndx)) >= 0; ) {
+ struct file_struct *file = cur_flist->files[ndx];
+ fname = local_name ? local_name : f_name(file, NULL);
+ if ((partialptr = partial_dir_fname(fname)) != NULL) {
+ if (make_backups > 0 && !make_backup(fname))
+ continue;
+ if (verbose > 2) {
+ rprintf(FINFO, "renaming %s to %s\n",
+ partialptr, fname);
+ }
+ /* We don't use robust_rename() here because the
+ * partial-dir must be on the same drive. */
+ if (do_rename(partialptr, fname) < 0) {
+ rsyserr(FERROR, errno,
+ "rename failed for %s (from %s)",
+ full_fname(fname), partialptr);
+ } else {
+ if (remove_source_files
+ || (preserve_hard_links && F_IS_HLINKED(file)))
+ send_msg_int(MSG_SUCCESS, ndx);
+ handle_partial_dir(partialptr, PDIR_DELETE);
+ }
+ }
+ }
+}
+
+static int get_next_gen_ndx(int fd, int next_gen_ndx, int desired_ndx)
+{
+ while (next_gen_ndx < desired_ndx) {
+ if (next_gen_ndx >= 0) {
+ rprintf(FINFO,
+ "(No batched update for%s \"%s\")\n",
+ redoing ? " resend of" : "",
+ f_name(cur_flist->files[next_gen_ndx], NULL));
+ }
+ next_gen_ndx = read_int(fd);
+ if (next_gen_ndx == -1) {
+ if (inc_recurse)
+ next_gen_ndx = first_flist->prev->used + first_flist->prev->ndx_start;
+ else
+ next_gen_ndx = cur_flist->used;
+ }
+ }
+ return next_gen_ndx;
+}