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