diff --git a/clientserver.c b/clientserver.c
--- a/clientserver.c
+++ b/clientserver.c
-@@ -38,6 +38,7 @@ extern int sanitize_paths;
+@@ -39,6 +39,7 @@ extern int numeric_ids;
extern int filesfrom_fd;
extern int remote_protocol;
extern int protocol_version;
extern int io_timeout;
extern int no_detach;
extern int write_batch;
-@@ -704,6 +705,8 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -746,6 +747,8 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
else if (am_root < 0) /* Treat --fake-super from client as --super. */
am_root = 2;
int io_error;
int checksum_len;
dev_t filesystem_dev; /* used to implement -x */
-@@ -122,6 +127,9 @@ static char empty_sum[MAX_DIGEST_LEN];
+@@ -121,6 +126,9 @@ static char tmp_sum[MAX_DIGEST_LEN];
+ static char empty_sum[MAX_DIGEST_LEN];
static int flist_count_offset; /* for --delete --progress */
static int dir_count = 0;
- static int high_hlink_ndx;
+static int checksum_matches = 0;
+static int checksum_updates = 0;
+static int regular_skipped = 0;
static struct file_list *checksum_flist = NULL;
- static void clean_flist(struct file_list *flist, int strip_root);
-@@ -317,7 +325,8 @@ static void flist_done_allocating(struct file_list *flist)
+ static void flist_sort_and_clean(struct file_list *flist, int strip_root);
+@@ -316,7 +324,8 @@ static void flist_done_allocating(struct file_list *flist)
/* The len count is the length of the basename + 1 for the null. */
static int add_checksum(const char *dirname, const char *basename, int len,
{
struct file_struct *file;
int alloc_len, extra_len;
-@@ -328,13 +337,14 @@ static int add_checksum(const char *dirname, const char *basename, int len,
+@@ -327,13 +336,14 @@ static int add_checksum(const char *dirname, const char *basename, int len,
if (file_length == 0)
return 0;
bp = pool_alloc(checksum_flist->file_pool, alloc_len, "add_checksum");
memset(bp, 0, extra_len + FILE_STRUCT_LEN);
-@@ -343,7 +353,14 @@ static int add_checksum(const char *dirname, const char *basename, int len,
+@@ -342,7 +352,14 @@ static int add_checksum(const char *dirname, const char *basename, int len,
bp += FILE_STRUCT_LEN;
memcpy(bp, basename, len);
file->mode = S_IFREG;
file->modtime = mtime;
file->len32 = (uint32)file_length;
-@@ -354,6 +371,8 @@ static int add_checksum(const char *dirname, const char *basename, int len,
+@@ -353,6 +370,8 @@ static int add_checksum(const char *dirname, const char *basename, int len,
file->dirname = dirname;
bp = F_SUM(file);
memcpy(bp, sum, checksum_len);
flist_expand(checksum_flist, 1);
checksum_flist->files[checksum_flist->used++] = file;
-@@ -363,17 +382,104 @@ static int add_checksum(const char *dirname, const char *basename, int len,
+@@ -362,17 +381,104 @@ static int add_checksum(const char *dirname, const char *basename, int len,
return 1;
}
+ counts_match = used == checksum_matches;
+ no_skipped = whole_dir && regular_skipped == 0;
+
-+ clean_flist(checksum_flist, 0);
++ flist_sort_and_clean(checksum_flist, 0);
+
+ checksum_flist->used = 0;
+ checksum_matches = 0;
if (checksum_flist) {
/* Reset the pool memory and empty the file-list array. */
pool_free_old(checksum_flist->file_pool,
-@@ -384,6 +490,9 @@ static void read_checksums(const char *dirname)
+@@ -383,6 +489,9 @@ static void read_checksums(const char *dirname)
checksum_flist->low = 0;
checksum_flist->high = -1;
if (!dirname)
return;
-@@ -402,7 +511,7 @@ static void read_checksums(const char *dirname)
+@@ -401,7 +510,7 @@ static void read_checksums(const char *dirname)
while (fgets(line, sizeof line, fp)) {
cp = line;
if (protocol_version >= 30) {
if (*cp == '=')
while (*++cp == '=') {}
else
-@@ -413,7 +522,14 @@ static void read_checksums(const char *dirname)
+@@ -412,7 +521,14 @@ static void read_checksums(const char *dirname)
}
if (*cp == '=') {
} else {
for (i = 0; i < checksum_len*2; i++, cp++) {
int x;
-@@ -431,13 +547,14 @@ static void read_checksums(const char *dirname)
+@@ -430,13 +546,14 @@ static void read_checksums(const char *dirname)
else
sum[i/2] = x << 4;
}
if (*cp == '=')
while (*++cp == '=') {}
else
-@@ -461,16 +578,16 @@ static void read_checksums(const char *dirname)
+@@ -460,16 +577,16 @@ static void read_checksums(const char *dirname)
break;
while (*++cp == ' ') {}
if (*cp != ' ')
break;
while (*++cp == ' ') {}
-@@ -487,8 +604,13 @@ static void read_checksums(const char *dirname)
+@@ -486,8 +603,13 @@ static void read_checksums(const char *dirname)
continue;
strlcpy(fbuf+dlen, cp, sizeof fbuf - dlen);
}
fclose(fp);
-@@ -1274,6 +1396,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1278,6 +1400,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
if (is_excluded(thisname, S_ISDIR(st.st_mode) != 0, filter_level)) {
if (ignore_perishable)
non_perishable_cnt++;
return NULL;
}
-@@ -1405,13 +1529,36 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1408,13 +1532,36 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
int j;
if (flist && (j = flist_find(checksum_flist, file)) >= 0) {
struct file_struct *fp = checksum_flist->sorted[j];
}
/* This code is only used by the receiver when it is building
-@@ -1703,6 +1850,9 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
+@@ -1709,6 +1856,9 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
closedir(d);
if (f >= 0 && recurse && !divert_dirs) {
int i, end = flist->used - 1;
/* send_if_directory() bumps flist->used, so use "end". */
-@@ -2281,7 +2431,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
+@@ -2274,6 +2424,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
+ }
+ } else
flist_eof = 1;
-
- if (checksum_updating && always_checksum && flist_eof)
-- read_checksums(NULL);
++
++ if (checksum_updating && always_checksum && flist_eof)
+ read_checksums(NULL); /* writes any last updates */
return flist;
diff --git a/loadparm.c b/loadparm.c
--- a/loadparm.c
+++ b/loadparm.c
-@@ -153,6 +153,7 @@ typedef struct
+@@ -154,6 +154,7 @@ typedef struct
int syslog_facility;
int timeout;
BOOL fake_super;
BOOL ignore_errors;
BOOL ignore_nonreadable;
-@@ -202,6 +203,7 @@ static service sDefault =
+@@ -205,6 +206,7 @@ static service sDefault =
/* syslog_facility; */ LOG_DAEMON,
/* timeout; */ 0,
/* fake_super; */ False,
/* ignore_errors; */ False,
/* ignore_nonreadable; */ False,
-@@ -301,6 +303,7 @@ static struct parm_struct parm_table[] =
- {"socket options", P_STRING, P_GLOBAL,&Globals.socket_options, NULL,0},
+@@ -306,6 +308,7 @@ static struct parm_struct parm_table[] =
{"auth users", P_STRING, P_LOCAL, &sDefault.auth_users, NULL,0},
+ {"charset", P_STRING, P_LOCAL, &sDefault.charset, NULL,0},
+ {"checksum updating", P_BOOL, P_LOCAL, &sDefault.checksum_updating, NULL,0},
{"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL,0},
{"dont compress", P_STRING, P_LOCAL, &sDefault.dont_compress, NULL,0},
{"exclude from", P_STRING, P_LOCAL, &sDefault.exclude_from, NULL,0},
-@@ -421,6 +424,7 @@ FN_LOCAL_INTEGER(lp_max_connections, max_connections)
- FN_LOCAL_INTEGER(lp_max_verbosity, max_verbosity)
+@@ -428,6 +431,7 @@ FN_LOCAL_INTEGER(lp_max_verbosity, max_verbosity)
+ FN_LOCAL_INTEGER(lp_syslog_facility, syslog_facility)
FN_LOCAL_INTEGER(lp_timeout, timeout)
+FN_LOCAL_BOOL(lp_checksum_updating, checksum_updating)
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -111,6 +111,7 @@ size_t bwlimit_writemax = 0;
+@@ -112,6 +112,7 @@ size_t bwlimit_writemax = 0;
int ignore_existing = 0;
int ignore_non_existing = 0;
int need_messages_from_generator = 0;
int max_delete = INT_MIN;
OFF_T max_size = 0;
OFF_T min_size = 0;
-@@ -311,6 +312,7 @@ void usage(enum logcode F)
+@@ -316,6 +317,7 @@ void usage(enum logcode F)
rprintf(F," -q, --quiet suppress non-error messages\n");
rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
rprintf(F," -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
rprintf(F," -r, --recursive recurse into directories\n");
-@@ -559,6 +561,7 @@ static struct poptOption long_options[] = {
+@@ -566,6 +568,7 @@ static struct poptOption long_options[] = {
{"checksum", 'c', POPT_ARG_VAL, &always_checksum, 1, 0, 0 },
{"no-checksum", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"no-c", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"block-size", 'B', POPT_ARG_LONG, &block_size, 0, 0, 0 },
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
-@@ -1957,7 +1960,9 @@ void server_options(char **args, int *argc_p)
+@@ -1988,7 +1991,9 @@ void server_options(char **args, int *argc_p)
args[ac++] = basis_dir[i];
}
}
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -678,6 +678,10 @@ extern int xattrs_ndx;
+@@ -680,6 +680,10 @@ extern int xattrs_ndx;
#define F_SUM(f) ((char*)OPT_EXTRA(f, LEN64_BUMP(f) + HLINK_BUMP(f) \
+ SUM_EXTRA_CNT - 1))
+
Note that rsync always verifies that each em(transferred) file was
correctly reconstructed on the receiving side by checking a whole-file
- checksum that is generated when as the file is transferred, but that
+ checksum that is generated as the file is transferred, but that
automatic after-the-transfer verification has nothing to do with this
option's before-the-transfer "Does this file need to be updated?" check.
diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
--- a/rsyncd.conf.yo
+++ b/rsyncd.conf.yo
-@@ -237,6 +237,20 @@ locking on this file to ensure that the max connections limit is not
+@@ -281,6 +281,20 @@ locking on this file to ensure that the max connections limit is not
exceeded for the modules sharing the lock file.
The default is tt(/var/run/rsyncd.lock).