Commit a2dc0996 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Clean up ListenTCP error handling (refs #320)

parent 9f8542d3
...@@ -296,14 +296,17 @@ int *__net_ListenTCP( vlc_object_t *p_this, const char *psz_host, int i_port ) ...@@ -296,14 +296,17 @@ int *__net_ListenTCP( vlc_object_t *p_this, const char *psz_host, int i_port )
fd = net_Socket( p_this, ptr->ai_family, ptr->ai_socktype, fd = net_Socket( p_this, ptr->ai_family, ptr->ai_socktype,
ptr->ai_protocol ); ptr->ai_protocol );
if( fd == -1 ) if( fd == -1 )
{
msg_Dbg( p_this, "socket error: %s", net_strerror( net_errno ) );
continue; continue;
}
/* Bind the socket */ /* Bind the socket */
if( bind( fd, ptr->ai_addr, ptr->ai_addrlen ) ) if( bind( fd, ptr->ai_addr, ptr->ai_addrlen ) )
{ {
int saved_errno; int saved_errno;
saved_errno = errno; saved_errno = net_errno;
net_Close( fd ); net_Close( fd );
#if !defined(WIN32) && !defined(UNDER_CE) #if !defined(WIN32) && !defined(UNDER_CE)
fd = rootwrap_bind( ptr->ai_family, ptr->ai_socktype, fd = rootwrap_bind( ptr->ai_family, ptr->ai_socktype,
...@@ -316,8 +319,8 @@ int *__net_ListenTCP( vlc_object_t *p_this, const char *psz_host, int i_port ) ...@@ -316,8 +319,8 @@ int *__net_ListenTCP( vlc_object_t *p_this, const char *psz_host, int i_port )
else else
#endif #endif
{ {
msg_Warn( p_this, "cannot bind socket (%s)", msg_Err( p_this, "cannot bind socket (%s)",
strerror( saved_errno ) ); net_strerror( saved_errno ) );
continue; continue;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment