From 08538bc579a4b91f63bb809b37cc2c353daa451f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 7 Oct 2010 23:39:04 +0000 Subject: copy_absolute(): keep the relative path if _wgetcwd() failed Instead of using the undefined content of the 'path' buffer. --- Modules/getpath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/getpath.c b/Modules/getpath.c index 9c59ef1..112d6d3 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -300,7 +300,11 @@ copy_absolute(wchar_t *path, wchar_t *p) if (p[0] == SEP) wcscpy(path, p); else { - _wgetcwd(path, MAXPATHLEN); + if (!_wgetcwd(path, MAXPATHLEN)) { + /* unable to get the current directory */ + wcscpy(path, p); + return; + } if (p[0] == '.' && p[1] == SEP) p += 2; joinpath(path, p); -- cgit v0.12