summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-10-11 00:49:57 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-10-11 00:49:57 (GMT)
commitf10a79aad4e2fc62d2c3675e89f873b22b185e7b (patch)
tree06b042ca03a71663d26ad95949807d1bd2472bf4 /Modules/posixmodule.c
parent2d8dcdcb06005858e87eded012ceff10920445b7 (diff)
downloadcpython-f10a79aad4e2fc62d2c3675e89f873b22b185e7b.zip
cpython-f10a79aad4e2fc62d2c3675e89f873b22b185e7b.tar.gz
cpython-f10a79aad4e2fc62d2c3675e89f873b22b185e7b.tar.bz2
merge from trunk
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 12ee9a8..c725b7d 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -751,11 +751,16 @@ 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) {
+ free(new_path);
+ return FALSE;
+ }
}
if (wcsncmp(new_path, L"\\\\", 2) == 0 ||
wcsncmp(new_path, L"//", 2) == 0)