]> granicus.if.org Git - python/commitdiff
Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle.
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 21 Oct 2012 14:33:33 +0000 (16:33 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 21 Oct 2012 14:33:33 +0000 (16:33 +0200)
Patch by Atsuo Ishimoto.

Misc/NEWS
Modules/posixmodule.c

index 91ebfacee76ba9d1e1f3fa3e3f7f3e27cdd51ea1..0f66e8def7eaf86179689499112f1d939d2c6761 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -59,6 +59,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle.
+  Patch by Atsuo Ishimoto.
+
 - Issue #16220: wsgiref now always calls close() on an iterable response.
   Patch by Brent Tubbs.
 
index 1089ae399be05d034e310548881d62e91a484d5f..0fe3963d1819ea5fea44ea2837a7225afc75978e 100644 (file)
@@ -1390,7 +1390,7 @@ attributes_from_dir_w(LPCWSTR pszFile, BY_HANDLE_FILE_INFORMATION *info, ULONG *
 }
 
 /* Grab GetFinalPathNameByHandle dynamically from kernel32 */
-static int has_GetFinalPathNameByHandle = 0;
+static int has_GetFinalPathNameByHandle = -1;
 static DWORD (CALLBACK *Py_GetFinalPathNameByHandleW)(HANDLE, LPWSTR, DWORD,
                                                       DWORD);
 static int
@@ -1401,7 +1401,7 @@ check_GetFinalPathNameByHandle()
                                                    DWORD);
 
     /* only recheck */
-    if (!has_GetFinalPathNameByHandle)
+    if (-1 == has_GetFinalPathNameByHandle)
     {
         hKernel32 = GetModuleHandleW(L"KERNEL32");
         *(FARPROC*)&Py_GetFinalPathNameByHandleA = GetProcAddress(hKernel32,