Branch: Tag:

2016-12-05

2016-12-05 12:49:06 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Survive setsockopt(SO_REUSEPORT) failing with EINVAL.

The Linux emulation layer in MS Windows 10 behaves this way.

Fixes [LysLysKOM 21915643].

4897: Inside #if defined(SO_REUSEPORT)
   /* FreeBSD 7.x wants this to reuse portnumbers.    * Linux 2.6.x seems to have reserved a slot for the option, but not    * enabled it. Survive libc's with the option on kernels without. +  * +  * The emulated Linux runtime on MS Windows 10 fails this with EINVAL.    */    o=1;    if((fd_setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (char *)&o, sizeof(int)) < 0)   #ifdef ENOPROTOOPT    && (errno != ENOPROTOOPT)   #endif -  + #ifdef EINVAL +  && (errno != EINVAL) + #endif   #ifdef WSAENOPROTOOPT    && (errno != WSAENOPROTOOPT)   #endif
4958: Inside #if defined(SO_REUSEPORT)
   /* FreeBSD 7.x wants this to reuse portnumbers.    * Linux 2.6.x seems to have reserved a slot for the option, but not    * enabled it. Survive libc's with the option on kernels without. +  * +  * The emulated Linux runtime on MS Windows 10 fails this with EINVAL.    */    o=1;    if((fd_setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (char *)&o, sizeof(int)) < 0)   #ifdef ENOPROTOOPT    && (errno != ENOPROTOOPT)   #endif -  + #ifdef EINVAL +  && (errno != EINVAL) + #endif   #ifdef WSAENOPROTOOPT    && (errno != WSAENOPROTOOPT)   #endif