Skip to content

Commit a6c6a96

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'work-around-isilon'
It would appear that least the Isilon network filesystem (and possibly other network filesystems, too), report non-standard error values when trying to access a non-existing directory. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents ee98317 + 10098be commit a6c6a96

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
@@ -449,8 +449,19 @@ static int mingw_open_append(wchar_t const *wfilename, int oflags, ...)
449449
handle = CreateFileW(wfilename, FILE_APPEND_DATA,
450450
FILE_SHARE_WRITE | FILE_SHARE_READ,
451451
NULL, create, FILE_ATTRIBUTE_NORMAL, NULL);
452-
if (handle == INVALID_HANDLE_VALUE)
453-
return errno = err_win_to_posix(GetLastError()), -1;
452+
if (handle == INVALID_HANDLE_VALUE) {
453+
DWORD err = GetLastError();
454+
/*
455+
* Some network storage solutions (e.g. Isilon) might return
456+
* ERROR_INVALID_PARAMETER instead of expected error
457+
* ERROR_PATH_NOT_FOUND, which results in a unknow error. If
458+
* so, the error is now forced to be an ERROR_PATH_NOT_FOUND
459+
* error instead.
460+
*/
461+
if (err == ERROR_INVALID_PARAMETER)
462+
err = ERROR_PATH_NOT_FOUND;
463+
return errno = err_win_to_posix(err), -1;
464+
}
454465

455466
/*
456467
* No O_APPEND here, because the CRT uses it only to reset the

0 commit comments

Comments
 (0)