mirror of
https://github.com/python/cpython.git
synced 2025-08-16 14:50:43 +00:00
copy_absolute(): keep the relative path if _wgetcwd() failed
Instead of using the undefined content of the 'path' buffer.
This commit is contained in:
parent
918616ce91
commit
08538bc579
1 changed files with 5 additions and 1 deletions
|
@ -300,7 +300,11 @@ copy_absolute(wchar_t *path, wchar_t *p)
|
||||||
if (p[0] == SEP)
|
if (p[0] == SEP)
|
||||||
wcscpy(path, p);
|
wcscpy(path, p);
|
||||||
else {
|
else {
|
||||||
_wgetcwd(path, MAXPATHLEN);
|
if (!_wgetcwd(path, MAXPATHLEN)) {
|
||||||
|
/* unable to get the current directory */
|
||||||
|
wcscpy(path, p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (p[0] == '.' && p[1] == SEP)
|
if (p[0] == '.' && p[1] == SEP)
|
||||||
p += 2;
|
p += 2;
|
||||||
joinpath(path, p);
|
joinpath(path, p);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue