X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/98b1689dcba04ad6385eca04a3d9c02b5f65f1e7..c5b6e57a136d5bdc1eff9ef11e69c7093065920e:/flist.c diff --git a/flist.c b/flist.c index ce723928..db1cd901 100644 --- a/flist.c +++ b/flist.c @@ -548,6 +548,9 @@ static void send_file_entry(int f, struct file_struct *file, int ndx) the_end: strlcpy(lastname, fname, MAXPATHLEN); + + if (S_ISREG(mode) || S_ISLNK(mode)) + stats.total_size += F_LENGTH(file); } static struct file_struct *recv_file_entry(struct file_list *flist, @@ -849,6 +852,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist, read_buf(f, bp, checksum_len); } + if (S_ISREG(mode) || S_ISLNK(mode)) + stats.total_size += file_length; + return file; } @@ -1090,9 +1096,6 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, file->mode = save_mode; } - if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) - stats.total_size += st.st_size; - if (basename_len == 0+1) return NULL; @@ -1300,7 +1303,7 @@ void send_extra_file_list(int f, int at_least) flist = flist_new(0, "send_extra_file_list"); start_write = stats.total_written; - write_int(f, NDX_FLIST_OFFSET - send_dir_ndx); + write_ndx(f, NDX_FLIST_OFFSET - send_dir_ndx); change_local_filter_dir(fbuf, dlen, send_dir_depth); send_directory(f, flist, send_dir_ndx, fbuf, dlen, FLAG_DIVERT_DIRS | FLAG_XFER_DIR); write_byte(f, 0); @@ -1319,7 +1322,7 @@ void send_extra_file_list(int f, int at_least) } else { while (DIR_NEXT_SIBLING(dp) < 0) { if ((send_dir_ndx = DIR_PARENT(dp)) < 0) { - write_int(f, NDX_FLIST_EOF); + write_ndx(f, NDX_FLIST_EOF); flist_eof = 1; change_local_filter_dir(NULL, 0, 0); goto finish; @@ -1630,7 +1633,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) * was just 1 item in the first file-list, send 1 more * file-list to check if this is a 1-file xfer. */ if (send_dir_ndx < 0) - write_int(f, NDX_DONE); + write_ndx(f, NDX_DONE); else send_extra_file_list(f, 1); } @@ -1679,9 +1682,6 @@ struct file_list *recv_file_list(int f) flags |= read_byte(f) << 8; file = recv_file_entry(flist, flags, f); - if (S_ISREG(file->mode) || S_ISLNK(file->mode)) - stats.total_size += F_LENGTH(file); - if (incremental && S_ISDIR(file->mode)) { flist_expand(dir_flist); dir_flist->files[dir_flist->count++] = file; @@ -1743,7 +1743,7 @@ struct file_list *recv_file_list(int f) void recv_additional_file_list(int f) { struct file_list *flist; - int ndx = read_int(f); + int ndx = read_ndx(f); if (ndx == NDX_DONE) { flist_eof = 1; change_local_filter_dir(NULL, 0, 0); @@ -2035,7 +2035,7 @@ static void clean_flist(struct file_list *flist, int strip_root, int no_dups) } } } - /* Dump empty all remaining empty dirs. */ + /* Dump all remaining empty dirs. */ while (1) { struct file_struct *fp = flist->files[prev_i]; if (F_DEPTH(fp) >= 0)