Skip to content

Commit a41b41c

Browse files
committed
Merge branch 'js/mingw-isilon-nfs'
* js/mingw-isilon-nfs: mingw: cope with the Isilon network file system
2 parents 33feaca + 23eafd9 commit a41b41c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

compat/mingw.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,21 @@ static int mingw_open_append(wchar_t const *wfilename, int oflags, ...)
460460
handle = CreateFileW(wfilename, FILE_APPEND_DATA,
461461
FILE_SHARE_WRITE | FILE_SHARE_READ,
462462
NULL, create, FILE_ATTRIBUTE_NORMAL, NULL);
463-
if (handle == INVALID_HANDLE_VALUE)
464-
return errno = err_win_to_posix(GetLastError()), -1;
463+
if (handle == INVALID_HANDLE_VALUE) {
464+
DWORD err = GetLastError();
465+
466+
/*
467+
* Some network storage solutions (e.g. Isilon) might return
468+
* ERROR_INVALID_PARAMETER instead of expected error
469+
* ERROR_PATH_NOT_FOUND, which results in an unknown error. If
470+
* so, let's turn the error to ERROR_PATH_NOT_FOUND instead.
471+
*/
472+
if (err == ERROR_INVALID_PARAMETER)
473+
err = ERROR_PATH_NOT_FOUND;
474+
475+
errno = err_win_to_posix(err);
476+
return -1;
477+
}
465478

466479
/*
467480
* No O_APPEND here, because the CRT uses it only to reset the

0 commit comments

Comments
 (0)