]> git.sesse.net Git - vlc/blobdiff - src/network/httpd.c
Use strlcpy()
[vlc] / src / network / httpd.c
index e2d75b66184ac1c74b0180e84855e91c43522967..26d0f4cd13a4918051262308558c9440e6cffeb5 100644 (file)
@@ -2448,7 +2448,13 @@ static void httpd_HostThread( httpd_host_t *host )
                         ioctlsocket( fd, FIONBIO, &i_dummy );
                     }
 #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 )
                     {
                         net_Close( fd );