From 0865a6f228a40e2b30ad88d65f8aec334523d83a Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 26 Jun 2013 01:03:36 +0200 Subject: [PATCH] windows: use WSAGetLastError(), not errno setsockopt() doesn't touch errno on failure. Use WSAGetLastError() instead. This is a back-port of commit 30a8b44 from the master branch. --- src/win/tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/win/tcp.c b/src/win/tcp.c index 8e95c384..91df4266 100644 --- a/src/win/tcp.c +++ b/src/win/tcp.c @@ -50,7 +50,7 @@ static int uv__tcp_nodelay(uv_tcp_t* handle, SOCKET socket, int enable) { TCP_NODELAY, (const char*)&enable, sizeof enable) == -1) { - uv__set_sys_error(handle->loop, errno); + uv__set_sys_error(handle->loop, WSAGetLastError()); return -1; } return 0; @@ -63,7 +63,7 @@ static int uv__tcp_keepalive(uv_tcp_t* handle, SOCKET socket, int enable, unsign SO_KEEPALIVE, (const char*)&enable, sizeof enable) == -1) { - uv__set_sys_error(handle->loop, errno); + uv__set_sys_error(handle->loop, WSAGetLastError()); return -1; } @@ -72,7 +72,7 @@ static int uv__tcp_keepalive(uv_tcp_t* handle, SOCKET socket, int enable, unsign TCP_KEEPALIVE, (const char*)&delay, sizeof delay) == -1) { - uv__set_sys_error(handle->loop, errno); + uv__set_sys_error(handle->loop, WSAGetLastError()); return -1; }