mirror of
https://github.com/python/cpython.git
synced 2025-08-15 22:30:42 +00:00
copy_absolute(): keep the relative path if getcwd() failed
Instead of using the undefined content of the 'path' buffer.
This commit is contained in:
parent
a06e9b8f6b
commit
354fe7e381
1 changed files with 5 additions and 1 deletions
|
@ -232,7 +232,11 @@ copy_absolute(char *path, char *p)
|
|||
if (p[0] == SEP)
|
||||
strcpy(path, p);
|
||||
else {
|
||||
getcwd(path, MAXPATHLEN);
|
||||
if (!getcwd(path, MAXPATHLEN)) {
|
||||
/* unable to get the current directory */
|
||||
strcpy(path, p);
|
||||
return;
|
||||
}
|
||||
if (p[0] == '.' && p[1] == SEP)
|
||||
p += 2;
|
||||
joinpath(path, p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue