summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compat/mingw.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 640dcb11de..03af369b2b 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1127,6 +1127,10 @@ char *mingw_getcwd(char *pointer, int len)
}
if (!ret || ret >= ARRAY_SIZE(wpointer))
return NULL;
+ if (GetFileAttributesW(wpointer) == INVALID_FILE_ATTRIBUTES) {
+ errno = ENOENT;
+ return NULL;
+ }
if (xwcstoutf(pointer, wpointer, len) < 0)
return NULL;
convert_slashes(pointer);