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);