Allow safe_fname() to tweak up to two name at a time.
[rsync/rsync.git] / generator.c
index 899e744..33fcf2a 100644 (file)
@@ -291,9 +291,8 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
                return;
        }
 
-       if (statret == 0 &&
-           !preserve_perms &&
-           (S_ISDIR(st.st_mode) == S_ISDIR(file->mode))) {
+       if (statret == 0 && !preserve_perms
+           && S_ISDIR(st.st_mode) == S_ISDIR(file->mode)) {
                /* if the file exists already and we aren't perserving
                 * permissions then act as though the remote end sent
                 * us the file permissions we already have */
@@ -404,9 +403,6 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
        }
 #endif
 
-       if (read_batch)
-               return;
-
        if (preserve_hard_links && hard_link_check(file, HL_CHECK_MASTER))
                return;
 
@@ -446,7 +442,7 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
                        return;
                if (errno == ENOENT) {
                        write_int(f_out,i);
-                       if (!dry_run)
+                       if (!dry_run && !read_batch)
                                write_sum_head(f_out, NULL);
                } else if (verbose > 1) {
                        rsyserr(FERROR, errno,
@@ -465,7 +461,7 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
                if (preserve_hard_links && hard_link_check(file, HL_SKIP))
                        return;
                write_int(f_out,i);
-               if (!dry_run)
+               if (!dry_run && !read_batch)
                        write_sum_head(f_out, NULL);
                return;
        }
@@ -489,7 +485,7 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
                return;
        }
 
-       if (dry_run) {
+       if (dry_run || read_batch) {
                write_int(f_out,i);
                return;
        }