diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-07 23:39:04 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-07 23:39:04 (GMT) |
commit | 08538bc579a4b91f63bb809b37cc2c353daa451f (patch) | |
tree | 5fd12cf06786b9beae072ddfeb79e556bad68157 /Modules | |
parent | 918616ce91d658f5dfeaffbab4430c6219841e0b (diff) | |
download | cpython-08538bc579a4b91f63bb809b37cc2c353daa451f.zip cpython-08538bc579a4b91f63bb809b37cc2c353daa451f.tar.gz cpython-08538bc579a4b91f63bb809b37cc2c353daa451f.tar.bz2 |
copy_absolute(): keep the relative path if _wgetcwd() failed
Instead of using the undefined content of the 'path' buffer.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/getpath.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |