From: Christophe Massiot Date: Tue, 2 Oct 2001 17:04:43 +0000 (+0000) Subject: * Fixed a warning in input_es.c ; X-Git-Tag: 0.2.91~95 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c67dcbe71be7ae51dc03fbedc104b84f586c8450;p=vlc * Fixed a warning in input_es.c ; * Don't connect on INADDR_ANY, patch courtesy of Mathias Kretschmer . --- diff --git a/plugins/mpeg/input_es.c b/plugins/mpeg/input_es.c index 483df70b95..e543f60230 100644 --- a/plugins/mpeg/input_es.c +++ b/plugins/mpeg/input_es.c @@ -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 * @@ -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" ) ) diff --git a/src/input/input.c b/src/input/input.c index d8ba850b4f..a27fcd6ff0 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -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 * @@ -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;