summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2005-09-16 05:52:54 +0000
committerWayne Davison <wayned@samba.org>2005-09-16 05:52:54 +0000
commit9a4a237edef9bd21139e4400838b8a99cabd2a98 (patch)
tree97408505b2c47af17f1070c11473b1f0387e6c80
parent5efbddbadb7e09e69c081cd2b8695285fd87a3de (diff)
downloadrsync-9a4a237edef9bd21139e4400838b8a99cabd2a98.tar.gz
rsync-9a4a237edef9bd21139e4400838b8a99cabd2a98.tar.bz2
rsync-9a4a237edef9bd21139e4400838b8a99cabd2a98.zip
Tweaked the code a little in the always_checksum handling of the
send & receive file-list functions.
-rw-r--r--flist.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/flist.c b/flist.c
index 3544e276..1a259bcd 100644
--- a/flist.c
+++ b/flist.c
@@ -480,19 +480,16 @@ void send_file_entry(struct file_struct *file, int f, unsigned short base_flags)
}
#endif
- if (always_checksum) {
+ if (always_checksum && (S_ISREG(mode) || protocol_version < 28)) {
char *sum;
+ int slen = protocol_version < 21 ? 2 : MD4_SUM_LENGTH;
if (S_ISREG(mode))
sum = file->u.sum;
- else if (protocol_version < 28) {
+ else {
/* Prior to 28, we sent a useless set of nulls. */
sum = empty_sum;
- } else
- sum = NULL;
- if (sum) {
- write_buf(f, sum,
- protocol_version < 21 ? 2 : MD4_SUM_LENGTH);
}
+ write_buf(f, sum, slen);
}
strlcpy(lastname, fname, MAXPATHLEN);
@@ -708,20 +705,17 @@ static struct file_struct *receive_file_entry(struct file_list *flist,
}
#endif
- if (always_checksum) {
+ if (always_checksum && (sum_len || protocol_version < 28)) {
char *sum;
+ int slen = protocol_version < 21 ? 2 : MD4_SUM_LENGTH;
if (sum_len) {
file->u.sum = sum = bp;
/*bp += sum_len;*/
- } else if (protocol_version < 28) {
+ } else {
/* Prior to 28, we get a useless set of nulls. */
sum = empty_sum;
- } else
- sum = NULL;
- if (sum) {
- read_buf(f, sum,
- protocol_version < 21 ? 2 : MD4_SUM_LENGTH);
}
+ read_buf(f, sum, slen);
}
if (!preserve_perms) {