Skip to content
Permalink
Browse files
Merge pull request #2488 from bmueller84/master
mingw: fix fatal error working on mapped network drives on Windows
  • Loading branch information
dscho committed Jan 22, 2020
2 parents 8f03c5e + eabf519 commit 387e7103e8c0d41fa1291b6a2c9447fe936a4805
Showing with 7 additions and 2 deletions.
  1. +7 −2 compat/mingw.c
@@ -1272,8 +1272,13 @@ char *mingw_getcwd(char *pointer, int len)
if (hnd != INVALID_HANDLE_VALUE) {
ret = GetFinalPathNameByHandleW(hnd, wpointer, ARRAY_SIZE(wpointer), 0);
CloseHandle(hnd);
if (!ret || ret >= ARRAY_SIZE(wpointer))
return NULL;
if (!ret || ret >= ARRAY_SIZE(wpointer)) {
ret = GetLongPathNameW(cwd, wpointer, ARRAY_SIZE(wpointer));
if (!ret || ret >= ARRAY_SIZE(wpointer)) {
errno = ret ? ENAMETOOLONG : err_win_to_posix(GetLastError());
return NULL;
}
}
if (xwcstoutf(pointer, normalize_ntpath(wpointer), len) < 0)
return NULL;
return pointer;

0 comments on commit 387e710

Please sign in to comment.