From ed7e79553edc2e65348019854b0fe52b73427daa Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 5 Mar 2005 16:42:52 +0000 Subject: [PATCH] Don't try to determine the phase we're in by looking at the value of csum_length -- it might have been computed to be SUM_LENGTH. Instead, look at the "phase" variable directly. --- generator.c | 7 ++++--- receiver.c | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/generator.c b/generator.c index 7403945c..62100f51 100644 --- a/generator.c +++ b/generator.c @@ -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: - * 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. @@ -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 @@ -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 (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; @@ -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 phase = 0; char fbuf[MAXPATHLEN]; int itemizing, maybe_PERMS_REPORT; enum logcode code; diff --git a/receiver.c b/receiver.c index 4ad71268..b0a9ebd5 100644 --- a/receiver.c +++ b/receiver.c @@ -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) { - 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) @@ -627,7 +626,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name, errstr, safe_fname(fname), keptstr, redostr); } - if (csum_length != SUM_LENGTH) { + if (!phase) { SIVAL(numbuf, 0, i); send_msg(MSG_REDO, numbuf, 4); } -- 2.34.1