Commit c42903688389fbe3a580ba252e262bec35e930bd

Authored by Stéphane Raimbault
1 parent a30eab37

Avoid C99 declaration in win32 section code (closes #92)

Thanks to oldfaber and endrelovas.
Showing 1 changed file with 2 additions and 3 deletions
src/modbus-tcp.c
@@ -221,13 +221,12 @@ static int _modbus_tcp_set_ipv4_options(int s) @@ -221,13 +221,12 @@ static int _modbus_tcp_set_ipv4_options(int s)
221 /* If the OS does not offer SOCK_NONBLOCK, fall back to setting FIONBIO to 221 /* If the OS does not offer SOCK_NONBLOCK, fall back to setting FIONBIO to
222 * make sockets non-blocking */ 222 * make sockets non-blocking */
223 /* Do not care about the return value, this is optional */ 223 /* Do not care about the return value, this is optional */
  224 + option = 1;
224 #if !defined(SOCK_NONBLOCK) && defined(FIONBIO) 225 #if !defined(SOCK_NONBLOCK) && defined(FIONBIO)
225 #ifdef OS_WIN32 226 #ifdef OS_WIN32
226 /* Setting FIONBIO expects an unsigned long according to MSDN */ 227 /* Setting FIONBIO expects an unsigned long according to MSDN */
227 - unsigned long ioctloption = 1;  
228 - ioctlsocket(s, FIONBIO, &ioctloption); 228 + ioctlsocket(s, FIONBIO, &option);
229 #else 229 #else
230 - option = 1;  
231 ioctl(s, FIONBIO, &option); 230 ioctl(s, FIONBIO, &option);
232 #endif 231 #endif
233 #endif 232 #endif