Skip to content

Commit 066c7a0

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 ba91130 + e4215a3 commit 066c7a0

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

449460
/*
450461
* No O_APPEND here, because the CRT uses it only to reset the

0 commit comments

Comments
 (0)