X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/2fedf3d596e781273ecf3db866adac701b344c6b..a63335196208a9a08d7b9164c3fd16f0b9b31bc2:/receiver.c diff --git a/receiver.c b/receiver.c index 2ae46205..60b6c2fb 100644 --- a/receiver.c +++ b/receiver.c @@ -40,7 +40,7 @@ extern int preserve_perms; extern int basis_dir_cnt; extern int make_backups; extern int cleanup_got_literal; -extern int remove_sent_files; +extern int remove_source_files; extern int append_mode; extern int sparse_files; extern int keep_partial; @@ -57,6 +57,8 @@ extern struct filter_list_struct server_filter_list; static struct bitbag *delayed_bits = NULL; static int phase = 0; +/* We're either updating the basis file or an identical copy: */ +static int updating_basis; /* @@ -216,7 +218,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, sum_update(map, len); } - if (inplace) { + if (updating_basis) { if (offset == offset2 && fd != -1) { OFF_T pos; if (flush_write_file(fd) < 0) @@ -296,7 +298,7 @@ static void handle_delayed_updates(struct file_list *flist, char *local_name) "rename failed for %s (from %s)", full_fname(fname), partialptr); } else { - if (remove_sent_files + if (remove_source_files || (preserve_hard_links && file->link_u.links)) { SIVAL(numbuf, 0, i); @@ -360,6 +362,8 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) if (delay_updates) delayed_bits = bitbag_create(flist->count); + updating_basis = inplace; + while (1) { cleanup_disable(); @@ -421,7 +425,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) } if (!do_xfers) { /* log the transfer */ - log_item(FNAME, file, &stats, iflags, NULL); + log_item(FCLIENT, file, &stats, iflags, NULL); if (read_batch) discard_receive_data(f_in, file->length); continue; @@ -459,6 +463,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) fnamecmp = get_backup_name(fname); break; case FNAMECMP_FUZZY: + updating_basis = 0; if (file->dirname) { pathjoin(fnamecmpbuf, MAXPATHLEN, file->dirname, xname); @@ -467,6 +472,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) fnamecmp = xname; break; default: + updating_basis = 0; if (fnamecmp_type >= basis_dir_cnt) { rprintf(FERROR, "invalid basis_dir index: %d.\n", @@ -546,7 +552,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) file->mode = dest_mode(file->mode, st.st_mode, exists); } - /* We now check to see if we are writing file "inplace" */ + /* We now check to see if we are writing the file "inplace" */ if (inplace) { fd2 = do_open(fname, O_WRONLY|O_CREAT, 0600); if (fd2 == -1) { @@ -596,7 +602,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) /* log the transfer */ if (log_before_transfer) - log_item(FNAME, file, &initial_stats, iflags, NULL); + log_item(FCLIENT, file, &initial_stats, iflags, NULL); else if (!am_server && verbose && do_progress) rprintf(FINFO, "%s\n", fname); @@ -644,7 +650,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) cleanup_disable(); if (recv_ok > 0) { - if (remove_sent_files + if (remove_source_files || (preserve_hard_links && file->link_u.links)) { SIVAL(numbuf, 0, i); send_msg(MSG_SUCCESS, numbuf, 4);