Commit 543ee0f1 authored by Victor Stinner's avatar Victor Stinner

copy_absolute(): keep the relative path if getcwd() failed

Instead of using the undefined content of the 'path' buffer.
parent 259af959
...@@ -232,7 +232,11 @@ copy_absolute(char *path, char *p) ...@@ -232,7 +232,11 @@ copy_absolute(char *path, char *p)
if (p[0] == SEP) if (p[0] == SEP)
strcpy(path, p); strcpy(path, p);
else { else {
getcwd(path, MAXPATHLEN); if (!getcwd(path, MAXPATHLEN)) {
/* unable to get the current directory */
strcpy(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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment