Skip to content

Commit a020468

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge pull request #2253 from naatje80/isilon_storage_error
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
2 parents db8db45 + 83c24ae commit a020468

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
@@ -663,8 +663,19 @@ static int mingw_open_append(wchar_t const *wfilename, int oflags, ...)
663663
handle = CreateFileW(wfilename, FILE_APPEND_DATA,
664664
FILE_SHARE_WRITE | FILE_SHARE_READ,
665665
NULL, create, FILE_ATTRIBUTE_NORMAL, NULL);
666-
if (handle == INVALID_HANDLE_VALUE)
667-
return errno = err_win_to_posix(GetLastError()), -1;
666+
if (handle == INVALID_HANDLE_VALUE) {
667+
DWORD err = GetLastError();
668+
/*
669+
* Some network storage solutions (e.g. Isilon) might return
670+
* ERROR_INVALID_PARAMETER instead of expected error
671+
* ERROR_PATH_NOT_FOUND, which results in a unknow error. If
672+
* so, the error is now forced to be an ERROR_PATH_NOT_FOUND
673+
* error instead.
674+
*/
675+
if (err == ERROR_INVALID_PARAMETER)
676+
err = ERROR_PATH_NOT_FOUND;
677+
return errno = err_win_to_posix(err), -1;
678+
}
668679

669680
/*
670681
* No O_APPEND here, because the CRT uses it only to reset the

0 commit comments

Comments
 (0)