summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2008-10-09 10:00:30 (GMT)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2008-10-09 10:00:30 (GMT)
commit10a018c285219b42d8a1cc972acf9e440a979106 (patch)
tree26c335c24e9f07aab0872471482f38f5b03e4156 /Modules/posixmodule.c
parentfc72de7bca50d6757bf4e920e668bb0e8da2f4fa (diff)
downloadcpython-10a018c285219b42d8a1cc972acf9e440a979106.zip
cpython-10a018c285219b42d8a1cc972acf9e440a979106.tar.gz
cpython-10a018c285219b42d8a1cc972acf9e440a979106.tar.bz2
On windows, os.chdir given unicode was not working if GetCurrentDirectoryW
returned a path longer than MAX_PATH. (But It's doubtful this code path is really executed because I cannot move to such directory on win2k)
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 79c3a44..6e4925b 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -726,11 +726,14 @@ win32_wchdir(LPCWSTR path)
if (!result)
return FALSE;
if (result > MAX_PATH+1) {
- new_path = malloc(result);
+ new_path = malloc(result * sizeof(wchar_t));
if (!new_path) {
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
+ result = GetCurrentDirectoryW(result, new_path);
+ if (!result)
+ return FALSE;
}
if (wcsncmp(new_path, L"\\\\", 2) == 0 ||
wcsncmp(new_path, L"//", 2) == 0)