| 263 | |
| 264 | #if defined NO_SYMLINK_XATTRS || defined NO_SYMLINK_USER_XATTRS |
| 265 | ssize_t do_readlink(const char *path, char *buf, size_t bufsiz) |
| 266 | { |
| 267 | /* For --fake-super, we read the link from the file. */ |
| 268 | if (am_root < 0) { |
| 269 | int fd = do_open_nofollow(path, O_RDONLY); |
| 270 | if (fd >= 0) { |
| 271 | int len = read(fd, buf, bufsiz); |
| 272 | close(fd); |
| 273 | return len; |
| 274 | } |
| 275 | if (errno != ELOOP) |
| 276 | return -1; |
| 277 | /* A real symlink needs to be turned into a fake one on the receiving |
| 278 | * side, so tell the generator that the link has no length. */ |
| 279 | if (!am_sender) |
| 280 | return 0; |
| 281 | /* Otherwise fall through and let the sender report the real length. */ |
| 282 | } |
| 283 | |
| 284 | return readlink(path, buf, bufsiz); |
| 285 | } |
| 286 | #endif |
| 287 | #endif |
| 288 |
no test coverage detected