- if (!S_ISDIR(f->mode)) {
- if (do_unlink(f_name(f)) != 0) {
- rprintf(FERROR,"unlink %s : %s\n",f_name(f),strerror(errno));
- } else if (verbose) {
- rprintf(FINFO,"deleting %s\n",f_name(f));
+ static char file_sum1[MD4_SUM_LENGTH];
+ static char file_sum2[MD4_SUM_LENGTH];
+ struct map_struct *mapbuf;
+ struct sum_struct sum;
+ int32 len;
+ OFF_T offset = 0;
+ OFF_T offset2;
+ char *data;
+ int32 i;
+ char *map = NULL;
+
+ read_sum_head(f_in, &sum);
+
+ if (fd_r >= 0 && size_r > 0) {
+ int32 read_size = MAX(sum.blength * 2, 16*1024);
+ mapbuf = map_file(fd_r, size_r, read_size, sum.blength);
+ if (verbose > 2) {
+ rprintf(FINFO, "recv mapped %s of size %.0f\n",
+ fname_r, (double)size_r);
+ }
+ } else
+ mapbuf = NULL;
+
+ sum_init(checksum_seed);
+
+ if (append_mode) {
+ OFF_T j;
+ sum.flength = (OFF_T)sum.count * sum.blength;
+ if (sum.remainder)
+ sum.flength -= sum.blength - sum.remainder;
+ for (j = CHUNK_SIZE; j < sum.flength; j += CHUNK_SIZE) {
+ if (do_progress)
+ show_progress(offset, total_size);
+ sum_update(map_ptr(mapbuf, offset, CHUNK_SIZE),
+ CHUNK_SIZE);
+ offset = j;
+ }
+ if (offset < sum.flength) {
+ int32 len = sum.flength - offset;
+ if (do_progress)
+ show_progress(offset, total_size);
+ sum_update(map_ptr(mapbuf, offset, len), len);
+ offset = sum.flength;