libowfat/socket/socket_bind6_reuse.c
leitner 1217583e2b now that gcc 11's static analyzer looks at array bounds in arguments
like "char ip[4]", let's be more strict about that
2021-04-27 17:39:42 +00:00

16 lines
408 B
C

#include <sys/types.h>
#ifndef __MINGW32__
#include <sys/socket.h>
#endif
#include "socket.h"
#include "windoze.h"
int socket_bind6_reuse(int s,const char ip[16],uint16 port,uint32 scope_id) {
int one=1;
setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&one,sizeof one);
#ifdef SO_REUSEPORT
setsockopt(s,SOL_SOCKET,SO_REUSEPORT,&one,sizeof one);
#endif
return winsock2errno(socket_bind6(s,ip,port,scope_id));
}