]> git.sesse.net Git - vlc/commitdiff
Put accept'd socket into non-blocking mode as the others
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 11 Feb 2007 17:22:20 +0000 (17:22 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 11 Feb 2007 17:22:20 +0000 (17:22 +0000)
Fixes #1051

src/network/tcp.c

index 7700269e74a0fae2e41115ec06e2130b29a3b89a..02f3f84e5f30cbd6233b4597988e553aa17a483c 100644 (file)
@@ -337,8 +337,11 @@ int __net_Accept( vlc_object_t *p_this, int *pi_fd, mtime_t i_wait )
             {
                 const int yes = 1;
                 setsockopt( i_fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof( yes ));
-#ifdef FD_CLOEXEC
-                fcntl( i_fd, F_SETFD, FD_CLOEXEC );
+#if defined (WIN32) || defined (UNDER_CE)
+                ioctlsocket (i_fd, FIONBIO, &(unsigned long){ 1 });
+#else
+                fcntl (i_fd, F_SETFD, FD_CLOEXEC);
+                fcntl (i_fd, F_SETFL, fcntl (i_fd, F_GETFL, 0) | O_NONBLOCK);
 #endif
                 /*
                  * This round-robin trick ensures that the first sockets in