W32 gstdio: Don't try to get reparse tag unconditionally

We do not need to use FindFirstFileW() to get a reparse tag if the
file that is being examined is not a reparse point.

This is a quick and relatively painless fix for the fact that
FindFirstFileW() fails on root directories. Since root directories
are unlikely to be reparse points (is it even possible?), not using
this function on non-reparse-points just sidesteps the issue.

https://bugzilla.gnome.org/show_bug.cgi?id=795153
This commit is contained in:
Руслан Ижбулатов 2018-04-11 11:11:24 +00:00
parent b33a454a42
commit 5741f203dc

View File

@ -210,18 +210,23 @@ _g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename,
*/
if (fd < 0)
{
HANDLE tmp = FindFirstFileW (filename,
&finddata);
memset (&finddata, 0, sizeof (finddata));
if (tmp == INVALID_HANDLE_VALUE)
if (handle_info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
{
error_code = GetLastError ();
errno = w32_error_to_errno (error_code);
CloseHandle (file_handle);
return -1;
}
HANDLE tmp = FindFirstFileW (filename,
&finddata);
FindClose (tmp);
if (tmp == INVALID_HANDLE_VALUE)
{
error_code = GetLastError ();
errno = w32_error_to_errno (error_code);
CloseHandle (file_handle);
return -1;
}
FindClose (tmp);
}
if (is_symlink && !for_symlink)
{