[glib] W32 gstdio: Don't try to get reparse tag unconditionally
- From: LRN <ruslanizhb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] W32 gstdio: Don't try to get reparse tag unconditionally
- Date: Wed, 11 Apr 2018 12:52:13 +0000 (UTC)
commit 5741f203dcfee60a1d2b803d7f2174d328c0176a
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Wed Apr 11 11:11:24 2018 +0000
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
glib/gstdio.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/glib/gstdio.c b/glib/gstdio.c
index 9b674d753..a374d9a51 100644
--- a/glib/gstdio.c
+++ b/glib/gstdio.c
@@ -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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]