]> git.sesse.net Git - vlc/commitdiff
* Fixed a warning in input_es.c ;
authorChristophe Massiot <massiot@videolan.org>
Tue, 2 Oct 2001 17:04:43 +0000 (17:04 +0000)
committerChristophe Massiot <massiot@videolan.org>
Tue, 2 Oct 2001 17:04:43 +0000 (17:04 +0000)
* Don't connect on INADDR_ANY, patch courtesy of Mathias Kretschmer
  <mathias@research.att.com>.

plugins/mpeg/input_es.c
src/input/input.c

index 483df70b95d20d51ddbe67e3755df9f742134958..e543f602309df24d42164127fb1b69f7050f9edb 100644 (file)
@@ -2,7 +2,7 @@
  * input_es.c: Elementary Stream demux and packet management
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: input_es.c,v 1.10 2001/10/02 16:46:59 massiot Exp $
+ * $Id: input_es.c,v 1.11 2001/10/02 17:04:42 massiot Exp $
  *
  * Author: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -125,8 +125,6 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
  *****************************************************************************/
 static int ESProbe( probedata_t *p_data )
 {
-    input_thread_t * p_input = (input_thread_t *)p_data;
-
     int i_score = 5;
 
     if( TestMethod( INPUT_METHOD_VAR, "es" ) )
index d8ba850b4fc978d917ca03cab2d7b6de6301c8a3..a27fcd6ff059ca465b1b6e8f2c78785bd3caacba 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input.c,v 1.133 2001/10/02 16:46:59 massiot Exp $
+ * $Id: input.c,v 1.134 2001/10/02 17:04:43 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -857,14 +857,14 @@ static void NetworkOpen( input_thread_t * p_input )
         return;
     }
 
-    /* Join the m/c group if sock is a multicast address */
+    /* Join the multicast group if the socket is a multicast address */
     if( IN_MULTICAST( ntohl(i_mc_group) ) )
     {
         struct ip_mreq imr;
 
         imr.imr_interface.s_addr = htonl(INADDR_ANY);
         imr.imr_multiaddr.s_addr = i_mc_group;
-        if( setsockopt( p_input->i_handle, IPPROTO_IP,IP_ADD_MEMBERSHIP,
+        if( setsockopt( p_input->i_handle, IPPROTO_IP, IP_ADD_MEMBERSHIP,
                         (char*)&imr, sizeof(struct ip_mreq) ) == -1 )
         {
             intf_ErrMsg( "input error: failed to join IP multicast group (%s)",
@@ -884,15 +884,19 @@ static void NetworkOpen( input_thread_t * p_input )
         return;
     }
 
-    /* And connect it */
-    if( connect( p_input->i_handle, (struct sockaddr *) &sock,
-                 sizeof( sock ) ) == (-1) )
+    /* Only connect if the user has passed a valid host */
+    if( sock.sin_addr.s_addr != INADDR_ANY )
     {
-        intf_ErrMsg( "input error: can't connect socket (%s)", 
-                     strerror(errno) );
-        close( p_input->i_handle );
-        p_input->b_error = 1;
-        return;
+        /* Connect the socket */
+        if( connect( p_input->i_handle, (struct sockaddr *) &sock,
+                     sizeof( sock ) ) == (-1) )
+        {
+            intf_ErrMsg( "input error: can't connect socket (%s)", 
+                         strerror(errno) );
+            close( p_input->i_handle );
+            p_input->b_error = 1;
+            return;
+        }
     }
 
     p_input->stream.b_pace_control = 0;