| 2122 | } |
| 2123 | |
| 2124 | void send_extra_file_list(int f, int at_least) |
| 2125 | { |
| 2126 | struct file_list *flist; |
| 2127 | int64 start_write; |
| 2128 | uint16 prev_flags; |
| 2129 | int save_io_error = io_error; |
| 2130 | |
| 2131 | if (flist_eof) |
| 2132 | return; |
| 2133 | |
| 2134 | if (at_least < 0) |
| 2135 | at_least = file_total - file_old_total + 1; |
| 2136 | |
| 2137 | /* Keep sending data until we have the requested number of |
| 2138 | * files in the upcoming file-lists. */ |
| 2139 | while (file_total - file_old_total < at_least) { |
| 2140 | struct file_struct *file = dir_flist->sorted[send_dir_ndx]; |
| 2141 | int dir_ndx, dstart = stats.num_dirs; |
| 2142 | const char *pathname = F_PATHNAME(file); |
| 2143 | int32 *dp; |
| 2144 | |
| 2145 | flist = flist_new(0, "send_extra_file_list"); |
| 2146 | start_write = stats.total_written; |
| 2147 | |
| 2148 | if (unsort_ndx) |
| 2149 | dir_ndx = F_NDX(file); |
| 2150 | else |
| 2151 | dir_ndx = send_dir_ndx; |
| 2152 | write_ndx(f, NDX_FLIST_OFFSET - dir_ndx); |
| 2153 | flist->parent_ndx = send_dir_ndx; /* the sending side must remember the sorted ndx value */ |
| 2154 | |
| 2155 | send1extra(f, file, flist); |
| 2156 | prev_flags = file->flags; |
| 2157 | dp = F_DIR_NODE_P(file); |
| 2158 | |
| 2159 | /* If there are any duplicate directory names that follow, we |
| 2160 | * send all the dirs together in one file-list. The dir_flist |
| 2161 | * tree links all the child subdirs onto the last dup dir. */ |
| 2162 | while ((dir_ndx = DIR_NEXT_SIBLING(dp)) >= 0 |
| 2163 | && dir_flist->sorted[dir_ndx]->flags & FLAG_DUPLICATE) { |
| 2164 | send_dir_ndx = dir_ndx; |
| 2165 | file = dir_flist->sorted[dir_ndx]; |
| 2166 | /* Try to avoid some duplicate scanning of identical dirs. */ |
| 2167 | if (F_PATHNAME(file) == pathname && prev_flags & FLAG_CONTENT_DIR) |
| 2168 | file->flags &= ~FLAG_CONTENT_DIR; |
| 2169 | send1extra(f, file, flist); |
| 2170 | prev_flags = file->flags; |
| 2171 | dp = F_DIR_NODE_P(file); |
| 2172 | } |
| 2173 | |
| 2174 | if (io_error == save_io_error || ignore_errors) |
| 2175 | write_end_of_flist(f, 0); |
| 2176 | else if (use_safe_inc_flist) |
| 2177 | write_end_of_flist(f, 1); |
| 2178 | else { |
| 2179 | if (delete_during) |
| 2180 | fatal_unsafe_io_error(); |
| 2181 | write_end_of_flist(f, 0); |
no test coverage detected