summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-09-18 10:56:29 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-09-18 10:56:29 (GMT)
commitbf3c1c32354499515496fa38215d103cb50dde3b (patch)
treeb31222be9ba53481ddeae6e53b242b722da2bf2a /Modules/posixmodule.c
parent17a564ecc9501e0cb33216e4cc2955b9b5ecc224 (diff)
downloadcpython-bf3c1c32354499515496fa38215d103cb50dde3b.zip
cpython-bf3c1c32354499515496fa38215d103cb50dde3b.tar.gz
cpython-bf3c1c32354499515496fa38215d103cb50dde3b.tar.bz2
Issue #28075: Fix test_access_denied in Python 3.5
I forgot there two variations of os.stat() in Python 3.5.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index becf654..c993fb6 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1607,7 +1607,9 @@ win32_xstat_impl_w(const wchar_t *path, struct _Py_stat_struct *result,
/* Either the target doesn't exist, or we don't have access to
get a handle to it. If the former, we need to return an error.
If the latter, we can use attributes_from_dir. */
- if (GetLastError() != ERROR_SHARING_VIOLATION)
+ DWORD lastError = GetLastError();
+ if (lastError != ERROR_ACCESS_DENIED &&
+ lastError != ERROR_SHARING_VIOLATION)
return -1;
/* Could not get attributes on open file. Fall back to
reading the directory. */
@@ -1617,7 +1619,7 @@ win32_xstat_impl_w(const wchar_t *path, struct _Py_stat_struct *result,
if (info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
if (traverse) {
/* Should traverse, but could not open reparse point handle */
- SetLastError(ERROR_SHARING_VIOLATION);
+ SetLastError(lastError);
return -1;
}
}