| 1568 | } |
| 1569 | |
| 1570 | static struct file_struct *send_file_name(int f, struct file_list *flist, |
| 1571 | const char *fname, STRUCT_STAT *stp, |
| 1572 | int flags, int filter_level) |
| 1573 | { |
| 1574 | struct file_struct *file; |
| 1575 | |
| 1576 | file = make_file(fname, flist, stp, flags, filter_level); |
| 1577 | if (!file) |
| 1578 | return NULL; |
| 1579 | |
| 1580 | if (chmod_modes && !S_ISLNK(file->mode) && file->mode) |
| 1581 | file->mode = tweak_mode(file->mode, chmod_modes); |
| 1582 | |
| 1583 | if (f >= 0) { |
| 1584 | char fbuf[MAXPATHLEN]; |
| 1585 | #ifdef SUPPORT_LINKS |
| 1586 | const char *symlink_name; |
| 1587 | int symlink_len; |
| 1588 | #ifdef ICONV_OPTION |
| 1589 | char symlink_buf[MAXPATHLEN]; |
| 1590 | #endif |
| 1591 | #endif |
| 1592 | #if defined SUPPORT_ACLS || defined SUPPORT_XATTRS |
| 1593 | stat_x sx; |
| 1594 | init_stat_x(&sx); |
| 1595 | #endif |
| 1596 | |
| 1597 | #ifdef SUPPORT_LINKS |
| 1598 | if (preserve_links && S_ISLNK(file->mode)) { |
| 1599 | symlink_name = F_SYMLINK(file); |
| 1600 | symlink_len = strlen(symlink_name); |
| 1601 | if (symlink_len == 0) { |
| 1602 | io_error |= IOERR_GENERAL; |
| 1603 | f_name(file, fbuf); |
| 1604 | rprintf(FERROR_XFER, |
| 1605 | "skipping symlink with 0-length value: %s\n", |
| 1606 | full_fname(fbuf)); |
| 1607 | return NULL; |
| 1608 | } |
| 1609 | } else { |
| 1610 | symlink_name = NULL; |
| 1611 | symlink_len = 0; |
| 1612 | } |
| 1613 | #endif |
| 1614 | |
| 1615 | #ifdef ICONV_OPTION |
| 1616 | if (ic_send != (iconv_t)-1) { |
| 1617 | xbuf outbuf, inbuf; |
| 1618 | |
| 1619 | INIT_CONST_XBUF(outbuf, fbuf); |
| 1620 | |
| 1621 | if (file->dirname) { |
| 1622 | INIT_XBUF_STRLEN(inbuf, (char*)file->dirname); |
| 1623 | outbuf.size -= 2; /* Reserve room for '/' & 1 more char. */ |
| 1624 | if (iconvbufs(ic_send, &inbuf, &outbuf, ICB_INIT) < 0) |
| 1625 | goto convert_error; |
| 1626 | outbuf.size += 2; |
| 1627 | fbuf[outbuf.len++] = '/'; |
no test coverage detected