Send the make_xattr()-generated xattr list for this flist entry. */
| 493 | |
| 494 | /* Send the make_xattr()-generated xattr list for this flist entry. */ |
| 495 | int send_xattr(int f, stat_x *sxp) |
| 496 | { |
| 497 | int ndx = find_matching_xattr(sxp->xattr); |
| 498 | |
| 499 | /* Send 0 (-1 + 1) to indicate that literal xattr data follows. */ |
| 500 | write_varint(f, ndx + 1); |
| 501 | |
| 502 | if (ndx < 0) { |
| 503 | rsync_xa *rxa; |
| 504 | int count = sxp->xattr->count; |
| 505 | write_varint(f, count); |
| 506 | for (rxa = sxp->xattr->items; count--; rxa++) { |
| 507 | size_t name_len = rxa->name_len; |
| 508 | const char *name = rxa->name; |
| 509 | /* Strip the rsync prefix from disguised namespaces. */ |
| 510 | if (name_len > RPRE_LEN |
| 511 | #ifdef HAVE_LINUX_XATTRS |
| 512 | && am_root < 0 |
| 513 | #endif |
| 514 | && name[RPRE_LEN] != '%' && HAS_PREFIX(name, RSYNC_PREFIX)) { |
| 515 | name += RPRE_LEN; |
| 516 | name_len -= RPRE_LEN; |
| 517 | } |
| 518 | #ifndef HAVE_LINUX_XATTRS |
| 519 | else { |
| 520 | /* Put everything else in the user namespace. */ |
| 521 | name_len += UPRE_LEN; |
| 522 | } |
| 523 | #endif |
| 524 | write_varint(f, name_len); |
| 525 | write_varint(f, rxa->datum_len); |
| 526 | #ifndef HAVE_LINUX_XATTRS |
| 527 | if (name_len > rxa->name_len) { |
| 528 | write_buf(f, USER_PREFIX, UPRE_LEN); |
| 529 | name_len -= UPRE_LEN; |
| 530 | } |
| 531 | #endif |
| 532 | write_buf(f, name, name_len); |
| 533 | if (rxa->datum_len > MAX_FULL_DATUM) |
| 534 | write_buf(f, rxa->datum + 1, xattr_sum_len); |
| 535 | else |
| 536 | write_bigbuf(f, rxa->datum, rxa->datum_len); |
| 537 | } |
| 538 | ndx = rsync_xal_store(sxp->xattr); /* adds item to rsync_xal_l */ |
| 539 | } |
| 540 | |
| 541 | return ndx; |
| 542 | } |
| 543 | |
| 544 | /* Return a flag indicating if we need to change a file's xattrs. If |
| 545 | * "find_all" is specified, also mark any abbreviated xattrs that we |
no test coverage detected