Don't try to determine the phase we're in by looking at the value
authorWayne Davison <wayned@samba.org>
Sat, 5 Mar 2005 16:42:52 +0000 (16:42 +0000)
committerWayne Davison <wayned@samba.org>
Sat, 5 Mar 2005 16:42:52 +0000 (16:42 +0000)
of csum_length -- it might have been computed to be SUM_LENGTH.
Instead, look at the "phase" variable directly.

generator.c
receiver.c

index 7403945..62100f5 100644 (file)
@@ -383,7 +383,7 @@ static int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
  * The block size is a rounded square root of file length.
  *
  * The checksum size is determined according to:
  * The block size is a rounded square root of file length.
  *
  * The checksum size is determined according to:
- *     blocksum_bits = BLOCKSUM_EXP + 2*log2(file_len) - log2(block_len)
+ *     blocksum_bits = BLOCKSUM_BIAS + 2*log2(file_len) - log2(block_len)
  * provided by Donovan Baarda which gives a probability of rsync
  * algorithm corrupting data and falling back using the whole md4
  * checksums.
  * provided by Donovan Baarda which gives a probability of rsync
  * algorithm corrupting data and falling back using the whole md4
  * checksums.
@@ -568,6 +568,8 @@ void check_for_finished_hlinks(int itemizing, enum logcode code)
        }
 }
 
        }
 }
 
+static int phase = 0;
+
 /* Acts on the_file_list->file's ndx'th item, whose name is fname.  If a dir,
  * make sure it exists, and has the right permissions/timestamp info.  For
  * all other non-regular files (symlinks, etc.) we create them here.  For
 /* Acts on the_file_list->file's ndx'th item, whose name is fname.  If a dir,
  * make sure it exists, and has the right permissions/timestamp info.  For
  * all other non-regular files (symlinks, etc.) we create them here.  For
@@ -707,7 +709,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                if (set_perms(fname, file, statret ? NULL : &st, 0)
                    && verbose && code && f_out != -1)
                        rprintf(code, "%s/\n", safe_fname(fname));
                if (set_perms(fname, file, statret ? NULL : &st, 0)
                    && verbose && code && f_out != -1)
                        rprintf(code, "%s/\n", safe_fname(fname));
-               if (delete_during && f_out != -1 && csum_length != SUM_LENGTH
+               if (delete_during && f_out != -1 && !phase
                    && (file->flags & FLAG_DEL_HERE))
                        delete_in_dir(the_file_list, fname, file);
                return;
                    && (file->flags & FLAG_DEL_HERE))
                        delete_in_dir(the_file_list, fname, file);
                return;
@@ -1091,7 +1093,6 @@ void generate_files(int f_out, struct file_list *flist, char *local_name,
                    int f_out_name)
 {
        int i, lull_mod;
                    int f_out_name)
 {
        int i, lull_mod;
-       int phase = 0;
        char fbuf[MAXPATHLEN];
        int itemizing, maybe_PERMS_REPORT;
        enum logcode code;
        char fbuf[MAXPATHLEN];
        int itemizing, maybe_PERMS_REPORT;
        enum logcode code;
index 4ad7126..b0a9ebd 100644 (file)
@@ -605,8 +605,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name,
                                send_msg(MSG_SUCCESS, numbuf, 4);
                        }
                } else if (!recv_ok) {
                                send_msg(MSG_SUCCESS, numbuf, 4);
                        }
                } else if (!recv_ok) {
-                       int msgtype = csum_length == SUM_LENGTH || read_batch ?
-                               FERROR : FINFO;
+                       int msgtype = phase || read_batch ? FERROR : FINFO;
                        if (msgtype == FERROR || verbose) {
                                char *errstr, *redostr, *keptstr;
                                if (!(keep_partial && partialptr) && !inplace)
                        if (msgtype == FERROR || verbose) {
                                char *errstr, *redostr, *keptstr;
                                if (!(keep_partial && partialptr) && !inplace)
@@ -627,7 +626,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name,
                                        errstr, safe_fname(fname),
                                        keptstr, redostr);
                        }
                                        errstr, safe_fname(fname),
                                        keptstr, redostr);
                        }
-                       if (csum_length != SUM_LENGTH) {
+                       if (!phase) {
                                SIVAL(numbuf, 0, i);
                                send_msg(MSG_REDO, numbuf, 4);
                        }
                                SIVAL(numbuf, 0, i);
                                send_msg(MSG_REDO, numbuf, 4);
                        }