Skip to content

Commit 8762e44

Browse files
naatje80Git for Windows Build Agent
authored and
Git for Windows Build Agent
committed
mingw: cope with the Isilon network file system
On certain network filesystems (currently encounterd with Isilon, but in theory more network storage solutions could be causing the same issue), when the directory in question is missing, `raceproof_create_file()` fails with an `ERROR_INVALID_PARAMETER` instead of an `ERROR_PATH_NOT_FOUND`. Since it is highly unlikely that we produce such an error by mistake (the parameters we pass are fairly benign), we can be relatively certain that the directory is missing in this instance. So let's just translate that error automagically. This fixes #1345. Signed-off-by: Nathan Sanders <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 0c8eeaa commit 8762e44

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

compat/mingw.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,19 @@ static int mingw_open_append(wchar_t const *wfilename, int oflags, ...)
661661
handle = CreateFileW(wfilename, FILE_APPEND_DATA,
662662
FILE_SHARE_WRITE | FILE_SHARE_READ,
663663
NULL, create, FILE_ATTRIBUTE_NORMAL, NULL);
664-
if (handle == INVALID_HANDLE_VALUE)
665-
return errno = err_win_to_posix(GetLastError()), -1;
664+
if (handle == INVALID_HANDLE_VALUE) {
665+
DWORD err = GetLastError();
666+
/*
667+
* Some network storage solutions (e.g. Isilon) might return
668+
* ERROR_INVALID_PARAMETER instead of expected error
669+
* ERROR_PATH_NOT_FOUND, which results in a unknow error. If
670+
* so, the error is now forced to be an ERROR_PATH_NOT_FOUND
671+
* error instead.
672+
*/
673+
if (err == ERROR_INVALID_PARAMETER)
674+
err = ERROR_PATH_NOT_FOUND;
675+
return errno = err_win_to_posix(err), -1;
676+
}
666677

667678
/*
668679
* No O_APPEND here, because the CRT uses it only to reset the

0 commit comments

Comments
 (0)