Branch: Tag:

2020-02-01

2020-02-01 13:17:17 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Port: Some code cleanup in bind().

Switch from SOL_TCP to IPPROTO_TCP as the latter is more portable.

Use fd_setsockopt() instead of straight setsockopt(), and perform
appropriate casting.

Fixes support for TCP_FASTOPEN on NT.

332:    my_set_close_on_exec(fd,1);       THREADS_ALLOW_UID(); -  if( !(tmp=fd_bind(fd, (struct sockaddr *)&addr, addr_len) < 0) ) +  if( !(tmp=fd_bind(fd, (struct sockaddr *)&addr, addr_len) < 0) ) {   #ifdef TCP_FASTOPEN -  tmp = 256, -  setsockopt(fd,SOL_TCP, TCP_FASTOPEN, &tmp, sizeof(tmp)), +  tmp = 256; +  fd_setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, (char *)&tmp, sizeof(tmp));   #endif -  (tmp = fd_listen(fd, 16384) < 0); +  tmp = (fd_listen(fd, 16384) < 0); +  }    THREADS_DISALLOW_UID();       if(!Pike_fp->current_object->prog)