Go back to requiring -r for deletes to happen.
[rsync/rsync.git] / receiver.c
CommitLineData
e327acec 1/* -*- c-file-style: "linux" -*-
17fadf7d 2
e327acec 3 Copyright (C) 1996-2000 by Andrew Tridgell
2f03f956 4 Copyright (C) Paul Mackerras 1996
17fadf7d 5
2f03f956
AT
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
17fadf7d 10
2f03f956
AT
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
17fadf7d 15
2f03f956
AT
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#include "rsync.h"
22
23extern int verbose;
b98f040e 24extern int recurse;
92b9eb97
WD
25extern int delete_after;
26extern int max_delete;
2f03f956
AT
27extern int csum_length;
28extern struct stats stats;
29extern int dry_run;
16cc9ca2
WD
30extern int read_batch;
31extern int batch_gen_fd;
2f03f956 32extern int am_server;
41cfde6b 33extern int protocol_version;
2f03f956 34extern int relative_paths;
566fce32 35extern int keep_dirlinks;
2f03f956 36extern int preserve_hard_links;
92b9eb97 37extern int preserve_perms;
2f03f956
AT
38extern int cvs_exclude;
39extern int io_error;
40extern char *tmpdir;
a7260c40 41extern char *partial_dir;
ee297522 42extern char *basis_dir[];
c56595d7 43extern int basis_dir_cnt;
53dd3135 44extern int make_backups;
16417f8b 45extern int do_progress;
d74a2e3e 46extern char *backup_dir;
53dd3135 47extern char *backup_suffix;
d74a2e3e 48extern int backup_suffix_len;
925c517f 49extern int cleanup_got_literal;
92b9eb97
WD
50extern int module_id;
51extern int ignore_errors;
52extern int orig_umask;
55e50d89 53extern int keep_partial;
ba582f75 54extern int checksum_seed;
a3221d2a 55extern int inplace;
2f03f956 56
5ebab6c1
WD
57extern struct exclude_list_struct server_exclude_list;
58
59
d74a2e3e
WD
60static int is_backup_file(char *fn)
61{
62 int k = strlen(fn) - backup_suffix_len;
63 return k > 0 && strcmp(fn+k, backup_suffix) == 0;
64}
2f03f956
AT
65
66
1e82e2ce
WD
67/* This deletes any files on the receiving side that are not present
68 * on the sending side. */
6957ae33 69void delete_files(struct file_list *flist)
2f03f956
AT
70{
71 struct file_list *local_file_list;
72 int i, j;
a24639bb 73 char *argv[1], fbuf[MAXPATHLEN];
0b73ca12 74 static int deletion_count;
2f03f956
AT
75
76 if (cvs_exclude)
77 add_cvs_excludes();
78
ef55c686 79 if (io_error && !(lp_ignore_errors(module_id) || ignore_errors)) {
2f03f956
AT
80 rprintf(FINFO,"IO error encountered - skipping file deletion\n");
81 return;
82 }
83
1e82e2ce 84 for (j = 0; j < flist->count; j++) {
71e27c46 85 if (!(flist->files[j]->flags & FLAG_DEL_START)
a5342644
WD
86 || !S_ISDIR(flist->files[j]->mode))
87 continue;
2f03f956 88
a24639bb 89 argv[0] = f_name_to(flist->files[j], fbuf);
2f03f956 90
a24639bb 91 if (!(local_file_list = send_file_list(-1, 1, argv)))
2f03f956 92 continue;
2f03f956
AT
93
94 if (verbose > 1)
ecc81fce 95 rprintf(FINFO, "deleting in %s\n", safe_fname(fbuf));
2f03f956 96
446e239e 97 for (i = local_file_list->count-1; i >= 0; i--) {
08b1b486 98 if (max_delete && deletion_count >= max_delete)
92b9eb97
WD
99 break;
100 if (!local_file_list->files[i]->basename)
101 continue;
102 if (flist_find(flist,local_file_list->files[i]) < 0) {
53dd3135 103 char *f = f_name(local_file_list->files[i]);
f80a8520
WD
104 int mode = local_file_list->files[i]->mode;
105 if (make_backups && (backup_dir || !is_backup_file(f))
106 && !S_ISDIR(mode)) {
d2a918b4 107 make_backup(f);
ecc81fce
WD
108 if (verbose) {
109 rprintf(FINFO, "deleting %s\n",
110 safe_fname(f));
111 }
d3363884
WD
112 } else {
113 delete_file(f, S_ISDIR(mode)
d97fd43a 114 ? DEL_DIR | DEL_RECURSE : 0);
d3363884 115 }
31f3b68a 116 deletion_count++;
53dd3135 117 }
2f03f956
AT
118 }
119 flist_free(local_file_list);
2f03f956
AT
120 }
121}
122
123
52d3e106
S
124/*
125 * get_tmpname() - create a tmp filename for a given filename
126 *
127 * If a tmpdir is defined, use that as the directory to
128 * put it in. Otherwise, the tmp filename is in the same
129 * directory as the given name. Note that there may be no
130 * directory at all in the given name!
17fadf7d 131 *
52d3e106
S
132 * The tmp filename is basically the given filename with a
133 * dot prepended, and .XXXXXX appended (for mkstemp() to
134 * put its unique gunk in). Take care to not exceed
135 * either the MAXPATHLEN or NAME_MAX, esp. the last, as
136 * the basename basically becomes 8 chars longer. In that
137 * case, the original name is shortened sufficiently to
138 * make it all fit.
17fadf7d 139 *
52d3e106
S
140 * Of course, there's no real reason for the tmp name to
141 * look like the original, except to satisfy us humans.
142 * As long as it's unique, rsync will work.
143 */
144
2f03f956
AT
145static int get_tmpname(char *fnametmp, char *fname)
146{
147 char *f;
52d3e106
S
148 int length = 0;
149 int maxname;
2f03f956 150
2f03f956 151 if (tmpdir) {
a24639bb 152 /* Note: this can't overflow, so the return value is safe */
b7cee949 153 length = strlcpy(fnametmp, tmpdir, MAXPATHLEN - 2);
52d3e106
S
154 fnametmp[length++] = '/';
155 fnametmp[length] = '\0'; /* always NULL terminated */
0c2ef5f4 156 }
52d3e106 157
0c2ef5f4 158 if ((f = strrchr(fname, '/')) != NULL) {
52d3e106
S
159 ++f;
160 if (!tmpdir) {
161 length = f - fname;
0c2ef5f4 162 /* copy up to and including the slash */
52d3e106 163 strlcpy(fnametmp, fname, length + 1);
0c2ef5f4 164 }
446e239e 165 } else
52d3e106 166 f = fname;
52d3e106
S
167 fnametmp[length++] = '.';
168 fnametmp[length] = '\0'; /* always NULL terminated */
2f03f956 169
52d3e106 170 maxname = MIN(MAXPATHLEN - 7 - length, NAME_MAX - 8);
2f03f956 171
0c2ef5f4 172 if (maxname < 1) {
52d3e106
S
173 rprintf(FERROR, "temporary filename too long: %s\n", fname);
174 fnametmp[0] = '\0';
2f03f956
AT
175 return 0;
176 }
177
17fadf7d 178 strlcpy(fnametmp + length, f, maxname);
52d3e106 179 strcat(fnametmp + length, ".XXXXXX");
2f03f956
AT
180
181 return 1;
182}
183
184
7e5fa372
WD
185static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
186 char *fname, int fd, OFF_T total_size)
2f03f956 187{
7e5fa372
WD
188 static char file_sum1[MD4_SUM_LENGTH];
189 static char file_sum2[MD4_SUM_LENGTH];
190 struct map_struct *mapbuf;
fc0257c9 191 struct sum_struct sum;
6c495e0d 192 int32 len;
2f03f956 193 OFF_T offset = 0;
89e540e6 194 OFF_T offset2;
2f03f956 195 char *data;
6c495e0d 196 int32 i;
e1f67417 197 char *map = NULL;
17fadf7d 198
fc0257c9 199 read_sum_head(f_in, &sum);
17fadf7d 200
7e5fa372 201 if (fd_r >= 0 && size_r > 0) {
80264051
WD
202 int32 read_size = MAX(sum.blength * 2, 16*1024);
203 mapbuf = map_file(fd_r, size_r, read_size, sum.blength);
7e5fa372
WD
204 if (verbose > 2) {
205 rprintf(FINFO, "recv mapped %s of size %.0f\n",
ecc81fce 206 safe_fname(fname_r), (double)size_r);
7e5fa372
WD
207 }
208 } else
209 mapbuf = NULL;
210
ba582f75 211 sum_init(checksum_seed);
17fadf7d 212
3f55bd5d 213 while ((i = recv_token(f_in, &data)) != 0) {
16417f8b
WD
214 if (do_progress)
215 show_progress(offset, total_size);
2f03f956
AT
216
217 if (i > 0) {
2f03f956 218 if (verbose > 3) {
5f808dfb
AT
219 rprintf(FINFO,"data recv %d at %.0f\n",
220 i,(double)offset);
2f03f956
AT
221 }
222
223 stats.literal_data += i;
224 cleanup_got_literal = 1;
17fadf7d 225
6c495e0d 226 sum_update(data, i);
2f03f956 227
c52461f9
WD
228 if (fd != -1 && write_file(fd,data,i) != i)
229 goto report_write_error;
2f03f956
AT
230 offset += i;
231 continue;
17fadf7d 232 }
2f03f956
AT
233
234 i = -(i+1);
6c495e0d 235 offset2 = i * (OFF_T)sum.blength;
fc0257c9 236 len = sum.blength;
d2a918b4 237 if (i == (int)sum.count-1 && sum.remainder != 0)
fc0257c9 238 len = sum.remainder;
17fadf7d 239
2f03f956 240 stats.matched_data += len;
17fadf7d 241
6c495e0d
WD
242 if (verbose > 3) {
243 rprintf(FINFO,
244 "chunk[%d] of size %ld at %.0f offset=%.0f\n",
245 i, (long)len, (double)offset2, (double)offset);
246 }
17fadf7d 247
446e239e
WD
248 if (mapbuf) {
249 map = map_ptr(mapbuf,offset2,len);
17fadf7d 250
c55f7021 251 see_token(map, len);
6c495e0d 252 sum_update(map, len);
c55f7021 253 }
17fadf7d 254
fab65a5b 255 if (inplace) {
89e540e6 256 if (offset == offset2 && fd != -1) {
c52461f9
WD
257 if (flush_write_file(fd) < 0)
258 goto report_write_error;
89e540e6
WD
259 offset += len;
260 if (do_lseek(fd, len, SEEK_CUR) != offset) {
fab65a5b
WD
261 rsyserr(FERROR, errno,
262 "lseek failed on %s",
263 full_fname(fname));
264 exit_cleanup(RERR_FILEIO);
265 }
89e540e6 266 continue;
a3221d2a 267 }
2f03f956 268 }
c52461f9
WD
269 if (fd != -1 && write_file(fd, map, len) != (int)len)
270 goto report_write_error;
2f03f956
AT
271 offset += len;
272 }
273
85f14172
WD
274 if (flush_write_file(fd) < 0)
275 goto report_write_error;
76c21947 276
a3221d2a 277#ifdef HAVE_FTRUNCATE
fab65a5b 278 if (inplace && fd != -1)
a3221d2a
WD
279 ftruncate(fd, offset);
280#endif
281
16417f8b
WD
282 if (do_progress)
283 end_progress(total_size);
2f03f956
AT
284
285 if (fd != -1 && offset > 0 && sparse_end(fd) != 0) {
c52461f9 286 report_write_error:
d62bcc17
WD
287 rsyserr(FERROR, errno, "write failed on %s",
288 full_fname(fname));
65417579 289 exit_cleanup(RERR_FILEIO);
2f03f956
AT
290 }
291
292 sum_end(file_sum1);
293
7e5fa372
WD
294 if (mapbuf)
295 unmap_file(mapbuf);
296
bc63ae3f 297 read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
d2a918b4 298 if (verbose > 2)
bc63ae3f 299 rprintf(FINFO,"got file_sum\n");
d2a918b4 300 if (fd != -1 && memcmp(file_sum1, file_sum2, MD4_SUM_LENGTH) != 0)
bc63ae3f 301 return 0;
2f03f956
AT
302 return 1;
303}
304
305
8ed9d849
WD
306static void discard_receive_data(int f_in, OFF_T length)
307{
7e5fa372 308 receive_data(f_in, NULL, -1, 0, NULL, -1, length);
8ed9d849
WD
309}
310
311
b35d0d8e
MP
312/**
313 * main routine for receiver process.
314 *
315 * Receiver process runs on the same host as the generator process. */
41cfde6b
WD
316int recv_files(int f_in, struct file_list *flist, char *local_name,
317 int f_in_name)
17fadf7d 318{
16cc9ca2 319 int next_gen_i = -1;
2f03f956
AT
320 int fd1,fd2;
321 STRUCT_STAT st;
446e239e 322 char *fname, fbuf[MAXPATHLEN];
f62c17e3 323 char template[MAXPATHLEN];
2f03f956 324 char fnametmp[MAXPATHLEN];
a7260c40 325 char *fnamecmp, *partialptr;
375a4556 326 char fnamecmpbuf[MAXPATHLEN];
2f03f956 327 struct file_struct *file;
1b7c47cb 328 struct stats initial_stats;
4e834af1
WD
329 int save_make_backups = make_backups;
330 int i, recv_ok, phase = 0;
11a5a3c7 331
d2a918b4 332 if (verbose > 2)
2f03f956 333 rprintf(FINFO,"recv_files(%d) starting\n",flist->count);
2f03f956 334
cb869c26 335 if (flist->hlink_pool) {
9935066b
S
336 pool_destroy(flist->hlink_pool);
337 flist->hlink_pool = NULL;
338 }
339
17fadf7d 340 while (1) {
2f03f956
AT
341 cleanup_disable();
342
343 i = read_int(f_in);
344 if (i == -1) {
16cc9ca2 345 if (read_batch) {
41cfde6b
WD
346 if (next_gen_i != flist->count) {
347 do {
348 if (f_in_name >= 0
349 && next_gen_i >= 0)
350 read_byte(f_in_name);
351 } while (read_int(batch_gen_fd) != -1);
352 }
16cc9ca2
WD
353 next_gen_i = -1;
354 }
355
4e834af1
WD
356 if (phase)
357 break;
5ebab6c1 358
4e834af1
WD
359 phase = 1;
360 csum_length = SUM_LENGTH;
361 if (verbose > 2)
362 rprintf(FINFO, "recv_files phase=%d\n", phase);
363 send_msg(MSG_DONE, "", 0);
aec6b9f8 364 if (keep_partial && !partial_dir)
4e834af1
WD
365 make_backups = 0; /* prevents double backup */
366 continue;
2f03f956
AT
367 }
368
369 if (i < 0 || i >= flist->count) {
17fadf7d 370 rprintf(FERROR,"Invalid file index %d in recv_files (count=%d)\n",
2f03f956 371 i, flist->count);
65417579 372 exit_cleanup(RERR_PROTOCOL);
2f03f956
AT
373 }
374
375 file = flist->files[i];
2f03f956 376
97feb557 377 stats.current_file_index = i;
2f03f956
AT
378 stats.num_transferred_files++;
379 stats.total_transferred_size += file->length;
925c517f 380 cleanup_got_literal = 0;
2f03f956
AT
381
382 if (local_name)
383 fname = local_name;
446e239e 384 else
3fef5364 385 fname = f_name_to(file, fbuf);
2f03f956
AT
386
387 if (dry_run) {
ecc81fce
WD
388 if (!am_server && verbose) /* log the transfer */
389 rprintf(FINFO, "%s\n", safe_fname(fname));
2f03f956
AT
390 continue;
391 }
392
1b7c47cb
AT
393 initial_stats = stats;
394
2f03f956 395 if (verbose > 2)
ecc81fce 396 rprintf(FINFO, "recv_files(%s)\n", safe_fname(fname));
2f03f956 397
16cc9ca2
WD
398 if (read_batch) {
399 while (i > next_gen_i) {
41cfde6b
WD
400 if (f_in_name >= 0 && next_gen_i >= 0)
401 read_byte(f_in_name);
16cc9ca2
WD
402 next_gen_i = read_int(batch_gen_fd);
403 if (next_gen_i == -1)
404 next_gen_i = flist->count;
405 }
406 if (i < next_gen_i) {
407 rprintf(FINFO, "skipping update for \"%s\"\n",
ecc81fce 408 safe_fname(fname));
16cc9ca2
WD
409 discard_receive_data(f_in, file->length);
410 continue;
411 }
41cfde6b 412 next_gen_i = -1;
16cc9ca2
WD
413 }
414
5ebab6c1
WD
415 if (server_exclude_list.head
416 && check_exclude(&server_exclude_list, fname,
417 S_ISDIR(file->mode)) < 0) {
33eff8bf
WD
418 rprintf(FERROR, "attempt to hack rsync failed.\n");
419 exit_cleanup(RERR_PROTOCOL);
5ebab6c1
WD
420 }
421
41cfde6b
WD
422 partialptr = partial_dir ? partial_dir_fname(fname) : fname;
423
424 if (f_in_name >= 0) {
ee297522
WD
425 uchar j;
426 switch (j = read_byte(f_in_name)) {
41cfde6b 427 case FNAMECMP_FNAME:
a7260c40 428 fnamecmp = fname;
41cfde6b
WD
429 break;
430 case FNAMECMP_PARTIAL_DIR:
431 fnamecmp = partialptr ? partialptr : fname;
432 break;
433 case FNAMECMP_BACKUP:
434 fnamecmp = get_backup_name(fname);
435 break;
41cfde6b 436 default:
c56595d7
WD
437 if (j >= basis_dir_cnt) {
438 rprintf(FERROR,
439 "invalid basis_dir index: %d.\n",
440 j);
441 exit_cleanup(RERR_PROTOCOL);
442 }
41cfde6b 443 pathjoin(fnamecmpbuf, sizeof fnamecmpbuf,
ee297522 444 basis_dir[j], fname);
41cfde6b
WD
445 fnamecmp = fnamecmpbuf;
446 break;
447 }
a7260c40 448 } else
41cfde6b 449 fnamecmp = fname;
dc55d7bd 450
17fadf7d 451 /* open the file */
8c9fd200 452 fd1 = do_open(fnamecmp, O_RDONLY, 0);
375a4556 453
2f03f956 454 if (fd1 != -1 && do_fstat(fd1,&st) != 0) {
d62bcc17
WD
455 rsyserr(FERROR, errno, "fstat %s failed",
456 full_fname(fnamecmp));
8ed9d849 457 discard_receive_data(f_in, file->length);
2f03f956
AT
458 close(fd1);
459 continue;
460 }
461
350e4e4d
S
462 if (fd1 != -1 && S_ISDIR(st.st_mode) && fnamecmp == fname) {
463 /* this special handling for directories
464 * wouldn't be necessary if robust_rename()
465 * and the underlying robust_unlink could cope
466 * with directories
467 */
ea42541f
WD
468 rprintf(FERROR,"recv_files: %s is a directory\n",
469 full_fname(fnamecmp));
8ed9d849 470 discard_receive_data(f_in, file->length);
2f03f956
AT
471 close(fd1);
472 continue;
473 }
474
350e4e4d
S
475 if (fd1 != -1 && !S_ISREG(st.st_mode)) {
476 close(fd1);
477 fd1 = -1;
350e4e4d
S
478 }
479
4df9f368 480 if (fd1 != -1 && !preserve_perms) {
85ed0aa3 481 /* if the file exists already and we aren't preserving
17fadf7d
WD
482 * permissions then act as though the remote end sent
483 * us the file permissions we already have */
4df9f368
AT
484 file->mode = st.st_mode;
485 }
486
a3221d2a
WD
487 /* We now check to see if we are writing file "inplace" */
488 if (inplace) {
dc55d7bd 489 fd2 = do_open(fname, O_WRONLY|O_CREAT, 0);
a3221d2a
WD
490 if (fd2 == -1) {
491 rsyserr(FERROR, errno, "open %s failed",
dc55d7bd 492 full_fname(fname));
8ed9d849 493 discard_receive_data(f_in, file->length);
a3221d2a
WD
494 if (fd1 != -1)
495 close(fd1);
496 continue;
497 }
498 } else {
499 if (!get_tmpname(fnametmp,fname)) {
8ed9d849 500 discard_receive_data(f_in, file->length);
a3221d2a
WD
501 if (fd1 != -1)
502 close(fd1);
503 continue;
504 }
505
506 strlcpy(template, fnametmp, sizeof template);
2f03f956 507
a3221d2a
WD
508 /* we initially set the perms without the
509 * setuid/setgid bits to ensure that there is no race
510 * condition. They are then correctly updated after
511 * the lchown. Thanks to snabb@epipe.fi for pointing
512 * this out. We also set it initially without group
513 * access because of a similar race condition. */
f62c17e3 514 fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS);
17fadf7d 515
a3221d2a
WD
516 /* in most cases parent directories will already exist
517 * because their information should have been previously
518 * transferred, but that may not be the case with -R */
519 if (fd2 == -1 && relative_paths && errno == ENOENT
520 && create_directory_path(fnametmp, orig_umask) == 0) {
521 strlcpy(fnametmp, template, sizeof fnametmp);
522 fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS);
523 }
524 if (fd2 == -1) {
525 rsyserr(FERROR, errno, "mkstemp %s failed",
526 full_fname(fnametmp));
8ed9d849 527 discard_receive_data(f_in, file->length);
a3221d2a
WD
528 if (fd1 != -1)
529 close(fd1);
530 continue;
531 }
532
a7260c40
WD
533 if (partialptr)
534 cleanup_set(fnametmp, partialptr, file, fd1, fd2);
a3221d2a 535 }
2f03f956 536
ecc81fce
WD
537 if (!am_server && verbose) /* log the transfer */
538 rprintf(FINFO, "%s\n", safe_fname(fname));
11a5a3c7 539
2f03f956 540 /* recv file data */
7e5fa372
WD
541 recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
542 fname, fd2, file->length);
1b7c47cb
AT
543
544 log_recv(file, &initial_stats);
17fadf7d 545
d2a918b4 546 if (fd1 != -1)
2f03f956 547 close(fd1);
9f27cd8c 548 if (close(fd2) < 0) {
d62bcc17
WD
549 rsyserr(FERROR, errno, "close failed on %s",
550 full_fname(fnametmp));
9f27cd8c
WD
551 exit_cleanup(RERR_FILEIO);
552 }
17fadf7d 553
aec6b9f8
WD
554 if (recv_ok || inplace) {
555 finish_transfer(fname, fnametmp, file, recv_ok, 1);
556 if (partialptr != fname && fnamecmp == partialptr) {
557 do_unlink(partialptr);
558 handle_partial_dir(partialptr, PDIR_DELETE);
559 }
560 } else if (keep_partial && partialptr
561 && handle_partial_dir(partialptr, PDIR_CREATE)) {
562 finish_transfer(partialptr, fnametmp, file, recv_ok,
563 !partial_dir);
564 } else {
a7260c40 565 partialptr = NULL;
55e50d89 566 do_unlink(fnametmp);
a7260c40
WD
567 }
568
2f03f956 569 cleanup_disable();
554e0a8d 570
2f03f956 571 if (!recv_ok) {
007e3c0e
WD
572 int msgtype = csum_length == SUM_LENGTH || read_batch ?
573 FERROR : FINFO;
574 if (msgtype == FERROR || verbose) {
a7260c40
WD
575 char *errstr, *redostr, *keptstr;
576 if (!(keep_partial && partialptr) && !inplace)
577 keptstr = "discarded";
578 else if (partial_dir)
579 keptstr = "put into partial-dir";
580 else
581 keptstr = "retained";
007e3c0e
WD
582 if (msgtype == FERROR) {
583 errstr = "ERROR";
584 redostr = "";
585 } else {
586 errstr = "WARNING";
587 redostr = " (will try again)";
588 }
589 rprintf(msgtype,
a7260c40 590 "%s: %s failed verification -- update %s%s.\n",
ecc81fce
WD
591 errstr, safe_fname(fname),
592 keptstr, redostr);
007e3c0e 593 }
e2bc4126 594 if (csum_length != SUM_LENGTH) {
0569a133 595 char buf[4];
0569a133
WD
596 SIVAL(buf, 0, i);
597 send_msg(MSG_REDO, buf, 4);
2f03f956
AT
598 }
599 }
600 }
4e834af1 601 make_backups = save_make_backups;
2f03f956 602
b98f040e 603 if (delete_after && recurse && !local_name && flist->count > 0)
3f55bd5d 604 delete_files(flist);
57df171b 605
2f03f956
AT
606 if (verbose > 2)
607 rprintf(FINFO,"recv_files finished\n");
17fadf7d 608
2f03f956
AT
609 return 0;
610}