summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/getpath.c6
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);