Windows: report UV_ENOTSOCK when we opened a file instead of a pipe
Makes the pipe_connect_to_file test pass on Windows.
This commit is contained in:
parent
e99fba47c8
commit
019118c3ab
@ -217,6 +217,11 @@ static int uv_set_pipe_handle(uv_loop_t* loop, uv_pipe_t* handle,
|
||||
DWORD mode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT;
|
||||
|
||||
if (!SetNamedPipeHandleState(pipeHandle, &mode, NULL, NULL)) {
|
||||
/* If this returns ERROR_INVALID_PARAMETER we probably opened something */
|
||||
/* that is not a pipe. */
|
||||
if (GetLastError() == ERROR_INVALID_PARAMETER) {
|
||||
SetLastError(WSAENOTSOCK);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user