return 1;
}
-/* We keep the do_lstat code in a separate function to avoid recursion.
- * When a path ends with a slash, the call to `GetFileAttributedExW()`
- * would fail. To prevent this, we strip any trailing slashes before that
- * call.
- *
- * If follow is true then act like stat() and report on the link
- * target. Otherwise report on the link itself.
- */
-static int do_lstat(int follow, const char *file_name, struct stat *buf)
+int mingw_lstat(const char *file_name, struct stat *buf)
{
WIN32_FILE_ATTRIBUTE_DATA fdata;
wchar_t wfilename[MAX_PATH];
if (handle != INVALID_HANDLE_VALUE) {
if ((findbuf.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
(findbuf.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) {
- if (follow) {
- char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
- buf->st_size = readlink(file_name, buffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
- } else {
- buf->st_mode = S_IFLNK;
- }
- buf->st_mode |= S_IREAD;
+ buf->st_mode = S_IFLNK | S_IREAD;
if (!(findbuf.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
buf->st_mode |= S_IWRITE;
}
return 0;
}
-int mingw_lstat(const char *file_name, struct stat *buf)
-{
- return do_lstat(0, file_name, buf);
-}
-
int mingw_stat(const char *file_name, struct stat *buf)
{
wchar_t wfile_name[MAX_PATH];