diff --git a/src/modbus-tcp.c b/src/modbus-tcp.c index e50cfc8..017026b 100644 --- a/src/modbus-tcp.c +++ b/src/modbus-tcp.c @@ -221,13 +221,12 @@ static int _modbus_tcp_set_ipv4_options(int s) /* If the OS does not offer SOCK_NONBLOCK, fall back to setting FIONBIO to * make sockets non-blocking */ /* Do not care about the return value, this is optional */ + option = 1; #if !defined(SOCK_NONBLOCK) && defined(FIONBIO) #ifdef OS_WIN32 /* Setting FIONBIO expects an unsigned long according to MSDN */ - unsigned long ioctloption = 1; - ioctlsocket(s, FIONBIO, &ioctloption); + ioctlsocket(s, FIONBIO, &option); #else - option = 1; ioctl(s, FIONBIO, &option); #endif #endif