| 2975 | } |
| 2976 | |
| 2977 | int 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 | |
| 3001 | pid_t waitpid(pid_t pid, int *status, int options) |
| 3002 | { |
no test coverage detected