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:
Bert Belder 2012-03-09 17:04:03 +01:00
parent e99fba47c8
commit 019118c3ab

View File

@ -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;
}