MCPcopy Create free account
hub / github.com/git/git / readlink

Function readlink

compat/mingw.c:2977–2999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2975}
2976
2977int readlink(const char *path, char *buf, size_t bufsiz)
2978{
2979 WCHAR wpath[MAX_PATH];
2980 char tmpbuf[MAX_PATH];
2981 int len;
2982 DWORD tag;
2983
2984 if (xutftowcs_path(wpath, path) < 0)
2985 return -1;
2986
2987 if (read_reparse_point(wpath, TRUE, tmpbuf, &len, &tag) < 0)
2988 return -1;
2989
2990 /*
2991 * Adapt to strange readlink() API: Copy up to bufsiz *bytes*, potentially
2992 * cutting off a UTF-8 sequence. Insufficient bufsize is *not* a failure
2993 * condition. There is no conversion function that produces invalid UTF-8,
2994 * so convert to a (hopefully large enough) temporary buffer, then memcpy
2995 * the requested number of bytes (including '\0' for robustness).
2996 */
2997 memcpy(buf, tmpbuf, min(bufsiz, len + 1));
2998 return min(bufsiz, len);
2999}
3000
3001pid_t waitpid(pid_t pid, int *status, int options)
3002{

Callers 3

validate_headrefFunction · 0.85
is_reinitFunction · 0.85
strbuf_readlinkFunction · 0.85

Calls 2

xutftowcs_pathFunction · 0.85
read_reparse_pointFunction · 0.85

Tested by

no test coverage detected