Commit d2357816 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

- Fix POSIX setting of non-blocking mode (we were clearing the R/W flags)

- Close-on-exec: Don't leak httpd client sockets into CGI scripts or
  whatever child process we spawn.
parent feef7142
...@@ -2448,7 +2448,13 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -2448,7 +2448,13 @@ static void httpd_HostThread( httpd_host_t *host )
ioctlsocket( fd, FIONBIO, &i_dummy ); ioctlsocket( fd, FIONBIO, &i_dummy );
} }
#else #else
fcntl( fd, F_SETFL, O_NONBLOCK ); fcntl( fd, F_SETFD, FD_CLOEXEC );
{
int i_val = fcntl( fd, F_GETFL );
fcntl( fd, F_SETFL,
O_NONBLOCK | (i_val != -1) ? i_val : 0 );
}
if( fd >= FD_SETSIZE ) if( fd >= FD_SETSIZE )
{ {
net_Close( fd ); net_Close( fd );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment