+ 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;
+ }
+ if (fd != -1 && do_lseek(fd, offset, SEEK_SET) != offset) {
+ rsyserr(FERROR, errno, "lseek failed on %s",
+ full_fname(fname));
+ exit_cleanup(RERR_FILEIO);
+ }
+ }
+