Skip to content

Commit

Permalink
Merge pull request #2488 from bmueller84/master
Browse files Browse the repository at this point in the history
mingw: fix fatal error working on mapped network drives on Windows
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Oct 10, 2024
2 parents 8d5b925 + e066033 commit f13abe7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,8 +1164,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;
Expand Down

0 comments on commit f13abe7

Please sign in to comment.