MCPcopy Index your code
hub / github.com/RsyncProject/rsync / do_readlink

Function do_readlink

syscall.c:265–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263
264#if defined NO_SYMLINK_XATTRS || defined NO_SYMLINK_USER_XATTRS
265ssize_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

Callers 3

list_fileFunction · 0.85
readlink_statFunction · 0.85
quick_check_okFunction · 0.85

Calls 1

do_open_nofollowFunction · 0.85

Tested by

no test coverage detected