1
0
mirror of https://github.com/libuv/libuv synced 2025-03-28 21:13:16 +00:00

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.
This commit is contained in:
Ben Noordhuis 2013-06-26 01:03:36 +02:00
parent 399c3ef55c
commit 0865a6f228

View File

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