comparison stream/tcp.c @ 31432:1bd903001629

Prefere the use of inet_ntop over inet_ntoa, as the former is ipv6 safe. This fixes bug #1491
author attila
date Sun, 20 Jun 2010 19:29:18 +0000
parents 2fa6d8411b07
children 4f9bc9acf17e
comparison
equal deleted inserted replaced
31431:29c120a9caad 31432:1bd903001629
185 default: 185 default:
186 mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af); 186 mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af);
187 return TCP_ERROR_FATAL; 187 return TCP_ERROR_FATAL;
188 } 188 }
189 189
190 #if HAVE_INET_ATON || defined(HAVE_WINSOCK2_H) 190 #if HAVE_INET_PTON
191 inet_ntop(af, our_s_addr, buf, 255);
192 #elif HAVE_INET_ATON || defined(HAVE_WINSOCK2_H)
191 av_strlcpy( buf, inet_ntoa( *((struct in_addr*)our_s_addr) ), 255); 193 av_strlcpy( buf, inet_ntoa( *((struct in_addr*)our_s_addr) ), 255);
192 #else
193 inet_ntop(af, our_s_addr, buf, 255);
194 #endif 194 #endif
195 if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port ); 195 if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port );
196 196
197 // Turn the socket as non blocking so we can timeout on the connection 197 // Turn the socket as non blocking so we can timeout on the connection
198 #if !HAVE_WINSOCK2_H 198 #if !HAVE_WINSOCK2_H