Skip to content

Commit e9bd7bd

Browse files
committed
common/sockets: fix logic error in WIN32 sock_set_nonblocking() impl
According to https://learn.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls "The lpvInBuffer parameter points at an unsigned long (QoS), which is nonzero if non-blocking mode is to be enabled and zero if it is to be disabled." Closes #613
1 parent 0e7caa1 commit e9bd7bd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/common/sockets.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
rfbBool sock_set_nonblocking(rfbSocket sock, rfbBool non_blocking, void (*log)(const char *format, ...))
3333
{
3434
#ifdef WIN32
35-
unsigned long block = non_blocking ? 0 : 1;
36-
if(ioctlsocket(sock, FIONBIO, &block) == SOCKET_ERROR) {
35+
unsigned long non_blocking_ulong = non_blocking;
36+
if(ioctlsocket(sock, FIONBIO, &non_blocking_ulong) == SOCKET_ERROR) {
3737
errno=WSAGetLastError();
3838
#else
3939
int flags = fcntl(sock, F_GETFL);

0 commit comments

Comments
 (0)