mirror of https://code.videolan.org/videolan/vlc
Clean up ListenTCP error handling (refs #320)
This commit is contained in:
parent
9f8542d3fd
commit
a2dc099691
|
@ -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,
|
||||
ptr->ai_protocol );
|
||||
if( fd == -1 )
|
||||
{
|
||||
msg_Dbg( p_this, "socket error: %s", net_strerror( net_errno ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Bind the socket */
|
||||
if( bind( fd, ptr->ai_addr, ptr->ai_addrlen ) )
|
||||
{
|
||||
int saved_errno;
|
||||
|
||||
saved_errno = errno;
|
||||
saved_errno = net_errno;
|
||||
net_Close( fd );
|
||||
#if !defined(WIN32) && !defined(UNDER_CE)
|
||||
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 )
|
|||
else
|
||||
#endif
|
||||
{
|
||||
msg_Warn( p_this, "cannot bind socket (%s)",
|
||||
strerror( saved_errno ) );
|
||||
msg_Err( p_this, "cannot bind socket (%s)",
|
||||
net_strerror( saved_errno ) );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue