| 320 | } |
| 321 | |
| 322 | int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr, char *buf, int *len_ptr) |
| 323 | { |
| 324 | int len, iflags = 0; |
| 325 | struct file_list *flist; |
| 326 | uchar fnamecmp_type = FNAMECMP_FNAME; |
| 327 | int ndx; |
| 328 | |
| 329 | read_loop: |
| 330 | while (1) { |
| 331 | ndx = read_ndx(f_in); |
| 332 | |
| 333 | if (ndx >= 0) |
| 334 | break; |
| 335 | if (ndx == NDX_DONE) |
| 336 | return ndx; |
| 337 | if (ndx == NDX_DEL_STATS) { |
| 338 | read_del_stats(f_in); |
| 339 | if (am_sender && am_server) |
| 340 | write_del_stats(f_out); |
| 341 | continue; |
| 342 | } |
| 343 | if (!inc_recurse || am_sender) { |
| 344 | int last; |
| 345 | if (first_flist) |
| 346 | last = first_flist->prev->ndx_start + first_flist->prev->used - 1; |
| 347 | else |
| 348 | last = -1; |
| 349 | rprintf(FERROR, |
| 350 | "Invalid file index: %d (%d - %d) [%s]\n", |
| 351 | ndx, NDX_DONE, last, who_am_i()); |
| 352 | exit_cleanup(RERR_PROTOCOL); |
| 353 | } |
| 354 | if (ndx == NDX_FLIST_EOF) { |
| 355 | flist_eof = 1; |
| 356 | if (DEBUG_GTE(FLIST, 3)) |
| 357 | rprintf(FINFO, "[%s] flist_eof=1\n", who_am_i()); |
| 358 | write_int(f_out, NDX_FLIST_EOF); |
| 359 | continue; |
| 360 | } |
| 361 | ndx = NDX_FLIST_OFFSET - ndx; |
| 362 | if (ndx < 0 || ndx >= dir_flist->used) { |
| 363 | ndx = NDX_FLIST_OFFSET - ndx; |
| 364 | rprintf(FERROR, |
| 365 | "Invalid dir index: %d (%d - %d) [%s]\n", |
| 366 | ndx, NDX_FLIST_OFFSET, |
| 367 | NDX_FLIST_OFFSET - dir_flist->used + 1, |
| 368 | who_am_i()); |
| 369 | exit_cleanup(RERR_PROTOCOL); |
| 370 | } |
| 371 | |
| 372 | if (DEBUG_GTE(FLIST, 2)) { |
| 373 | rprintf(FINFO, "[%s] receiving flist for dir %d\n", |
| 374 | who_am_i(), ndx); |
| 375 | } |
| 376 | /* Send all the data we read for this flist to the generator. */ |
| 377 | start_flist_forward(ndx); |
| 378 | flist = recv_file_list(f_in, ndx); |
| 379 | flist->parent_ndx = ndx; |
no test coverage detected