Skip to content

Commit 08538bc

Browse files
author
Victor Stinner
committed
copy_absolute(): keep the relative path if _wgetcwd() failed
Instead of using the undefined content of the 'path' buffer.
1 parent 918616c commit 08538bc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎Modules/getpath.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,11 @@ copy_absolute(wchar_t *path, wchar_t *p)
300300
if (p[0] == SEP)
301301
wcscpy(path, p);
302302
else {
303-
_wgetcwd(path, MAXPATHLEN);
303+
if (!_wgetcwd(path, MAXPATHLEN)) {
304+
/* unable to get the current directory */
305+
wcscpy(path, p);
306+
return;
307+
}
304308
if (p[0] == '.' && p[1] == SEP)
305309
p += 2;
306310
joinpath(path, p);

0 commit comments

Comments
 (0)