Skip to content

Commit 0989540

Browse files
committed
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 f6998aa + 18d685d commit 0989540

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

447458
/*
448459
* No O_APPEND here, because the CRT uses it only to reset the

0 commit comments

Comments
 (0)