Skip to content

Commit 06ca3dc

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge pull request #2488 from bmueller84/master
mingw: fix fatal error working on mapped network drives on Windows
2 parents a030cf3 + 7228414 commit 06ca3dc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

compat/mingw.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -1231,8 +1231,13 @@ char *mingw_getcwd(char *pointer, int len)
12311231
if (hnd != INVALID_HANDLE_VALUE) {
12321232
ret = GetFinalPathNameByHandleW(hnd, wpointer, ARRAY_SIZE(wpointer), 0);
12331233
CloseHandle(hnd);
1234-
if (!ret || ret >= ARRAY_SIZE(wpointer))
1235-
return NULL;
1234+
if (!ret || ret >= ARRAY_SIZE(wpointer)) {
1235+
ret = GetLongPathNameW(cwd, wpointer, ARRAY_SIZE(wpointer));
1236+
if (!ret || ret >= ARRAY_SIZE(wpointer)) {
1237+
errno = ret ? ENAMETOOLONG : err_win_to_posix(GetLastError());
1238+
return NULL;
1239+
}
1240+
}
12361241
if (xwcstoutf(pointer, normalize_ntpath(wpointer), len) < 0)
12371242
return NULL;
12381243
return pointer;

0 commit comments

Comments
 (0)