X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/20f0d0f9b9d4b373fdd2198a71d43a2c987e252a..8ef246e0b5a3aa9944dab4275353c50aab9f955c:/sender.c diff --git a/sender.c b/sender.c index 52aaa9c6..3808cda8 100644 --- a/sender.c +++ b/sender.c @@ -128,9 +128,9 @@ void successful_send(int ndx) return; file = the_file_list->files[ndx]; - if (file->dir.root) { + if (F_ROOTDIR(file)) { offset = stringjoin(fname, sizeof fname, - file->dir.root, "/", NULL); + F_ROOTDIR(file), "/", NULL); } else offset = 0; f_name(file, fname + offset); @@ -143,6 +143,19 @@ void successful_send(int ndx) } } +void write_ndx_and_attrs(int f_out, int ndx, int iflags, + uchar fnamecmp_type, char *buf, int len) +{ + write_int(f_out, ndx); + if (protocol_version < 29) + return; + write_shortint(f_out, iflags); + if (iflags & ITEM_BASIS_TYPE_FOLLOWS) + write_byte(f_out, fnamecmp_type); + if (iflags & ITEM_XNAME_FOLLOWS) + write_vstring(f_out, buf, len); +} + void send_files(struct file_list *flist, int f_out, int f_in) { int fd = -1; @@ -169,13 +182,13 @@ void send_files(struct file_list *flist, int f_out, int f_in) unsigned int offset; i = read_int(f_in); - if (i == -1) { + if (i == NDX_DONE) { if (++phase > max_phase) break; csum_length = SUM_LENGTH; if (verbose > 2) rprintf(FINFO, "send_files phase=%d\n", phase); - write_int(f_out, -1); + write_int(f_out, NDX_DONE); /* For inplace: redo phase turns off the backup * flag so that we do a regular inplace send. */ make_backups = 0; @@ -189,9 +202,9 @@ void send_files(struct file_list *flist, int f_out, int f_in) continue; file = flist->files[i]; - if (file->dir.root) { + if (F_ROOTDIR(file)) { /* N.B. We're sure that this fits, so offset is OK. */ - offset = strlcpy(fname, file->dir.root, sizeof fname); + offset = strlcpy(fname, F_ROOTDIR(file), sizeof fname); if (!offset || fname[offset-1] != '/') fname[offset++] = '/'; } else @@ -217,7 +230,7 @@ void send_files(struct file_list *flist, int f_out, int f_in) stats.current_file_index = i; stats.num_transferred_files++; - stats.total_transferred_size += file->length; + stats.total_transferred_size += F_LENGTH(file); if (!do_xfers) { /* log the transfer */ log_item(FCLIENT, file, &stats, iflags, NULL); @@ -319,5 +332,5 @@ void send_files(struct file_list *flist, int f_out, int f_in) match_report(); - write_int(f_out, -1); + write_int(f_out, NDX_DONE); }