]> git.sesse.net Git - vlc/commitdiff
Fix descriptor leak and remove useless code
authorRémi Denis-Courmont <rem@videolan.org>
Wed, 21 Feb 2007 19:27:18 +0000 (19:27 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Wed, 21 Feb 2007 19:27:18 +0000 (19:27 +0000)
modules/control/telnet.c

index 72ae6f61d9308341789ed1c66aa272092826085f..86af294b4dc7b52686d6c9e8386b26153469b056 100644 (file)
@@ -251,20 +251,9 @@ static void Run( intf_thread_t *p_intf )
 
         /* if a new client wants to communicate */
         fd = net_Accept( p_intf, p_sys->pi_fd, p_sys->i_clients > 0 ? 0 : -1 );
-        if( fd > 0 )
+        if( fd != -1 )
         {
-            telnet_client_t *cl = NULL;
-
-            /* to be non blocking */
-#if defined( WIN32 ) || defined( UNDER_CE )
-            {
-                unsigned long i_dummy = 1;
-                ioctlsocket( fd, FIONBIO, &i_dummy );
-            }
-#else
-            fcntl( fd, F_SETFL, O_NONBLOCK );
-#endif
-            cl = malloc( sizeof( telnet_client_t ));
+            telnet_client_t *cl = malloc( sizeof( telnet_client_t ));
             if( cl )
             {
                 memset( cl, 0, sizeof(telnet_client_t) );
@@ -279,7 +268,7 @@ static void Run( intf_thread_t *p_intf )
             }
             else
             {
-                msg_Err( p_intf, "Out of mem");
+                net_Close( fd );
                 continue;
             }
         }