else if (len <= BLOCK_SIZE * BLOCK_SIZE)
blength = BLOCK_SIZE;
else {
+ int32 max_blength = protocol_version < 30 ? OLD_MAX_BLOCK_SIZE : MAX_BLOCK_SIZE;
int32 c;
int cnt;
for (c = 1, l = len, cnt = 0; l >>= 2; c <<= 1, cnt++) {}
- if (cnt >= 31 || c >= MAX_BLOCK_SIZE)
- blength = MAX_BLOCK_SIZE;
+ if (c < 0 || c >= max_blength)
+ blength = max_blength;
else {
blength = 0;
do {
if (j == -2) {
itemizing = 0;
code = FNONE;
+ statret = 1;
} else if (j >= 0)
statret = 1;
}
goto cleanup;
}
}
+#ifdef SUPPORT_XATTRS
+ if (preserve_xattrs && statret == 1)
+ copy_xattrs(fnamecmpbuf, fname);
+#endif
if (set_file_attrs(fname, file, real_ret ? NULL : &real_sx, NULL, 0)
&& verbose && code != FNONE && f_out != -1)
rprintf(code, "%s/\n", fname);
if (read_batch)
goto cleanup;
- if (statret != 0 || whole_file || sx.st.st_size <= 0)
+ if (statret != 0 || whole_file)
write_sum_head(f_out, NULL);
- else {
+ else if (sx.st.st_size <= 0) {
+ write_sum_head(f_out, NULL);
+ close(fd);
+ } else {
if (generate_and_send_sums(fd, sx.st.st_size, f_out, f_copy) < 0) {
rprintf(FWARNING,
"WARNING: file is too large for checksum sending: %s\n",