From 019118c3abcf3e26c4b4e6e49dbdf4e0ec5071b0 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Fri, 9 Mar 2012 17:04:03 +0100 Subject: [PATCH] Windows: report UV_ENOTSOCK when we opened a file instead of a pipe Makes the pipe_connect_to_file test pass on Windows. --- src/win/pipe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/win/pipe.c b/src/win/pipe.c index f99a32a9..83220a23 100644 --- a/src/win/pipe.c +++ b/src/win/pipe.c @@ -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; }