+ if (read_batch) {
+ while (i > next_gen_i) {
+ next_gen_i = read_int(batch_gen_fd);
+ if (next_gen_i == -1)
+ next_gen_i = flist->count;
+ }
+ if (i < next_gen_i) {
+ rprintf(FINFO, "skipping update for \"%s\"\n",
+ safe_fname(fname));
+ discard_receive_data(f_in, file->length);
+ continue;
+ }
+ }
+
+ if (server_exclude_list.head
+ && check_exclude(&server_exclude_list, fname,
+ S_ISDIR(file->mode)) < 0) {
+ rprintf(FERROR, "attempt to hack rsync failed.\n");
+ exit_cleanup(RERR_PROTOCOL);
+ }
+
+ if (partial_dir) {
+ if ((partialptr = partial_dir_fname(fname)) != NULL)
+ fnamecmp = partialptr;
+ else
+ fnamecmp = fname;
+ } else
+ fnamecmp = partialptr = fname;
+
+ if (inplace && make_backups) {
+ if (!(fnamecmp = get_backup_name(fname)))
+ fnamecmp = partialptr;
+ }
+
+ /* open the file */
+ fd1 = do_open(fnamecmp, O_RDONLY, 0);
+
+ if (fd1 == -1 && fnamecmp != fname) {
+ fnamecmp = fname;
+ fd1 = do_open(fnamecmp, O_RDONLY, 0);
+ }
+
+ if (fd1 == -1 && compare_dest != NULL) {
+ /* try the file at compare_dest instead */
+ pathjoin(fnamecmpbuf, sizeof fnamecmpbuf,
+ compare_dest, fname);
+ fnamecmp = fnamecmpbuf;
+ fd1 = do_open(fnamecmp, O_RDONLY, 0);
+ }