comparison libpurple/network.c @ 29768:ce3f4bd8939b

Oops, probably better if we have both getifaddrs() and inet_ntop()
author Paul Aurich <paul@darkrain42.org>
date Tue, 16 Feb 2010 02:56:10 +0000
parents 529233281dfe
children 35a1cf247168
comparison
equal deleted inserted replaced
29767:2c955a6f1fa8 29768:ce3f4bd8939b
204 } 204 }
205 205
206 GList * 206 GList *
207 purple_network_get_all_local_system_ips(void) 207 purple_network_get_all_local_system_ips(void)
208 { 208 {
209 #ifdef HAVE_GETIFADDRS 209 #if defined(HAVE_GETIFADDRS) && defined(HAVE_INET_NTOP)
210 GList *result = NULL; 210 GList *result = NULL;
211 struct ifaddrs *start, *ifa; 211 struct ifaddrs *start, *ifa;
212 int ret; 212 int ret;
213 213
214 ret = getifaddrs(&start); 214 ret = getifaddrs(&start);
243 } 243 }
244 244
245 freeifaddrs(start); 245 freeifaddrs(start);
246 246
247 return g_list_reverse(result); 247 return g_list_reverse(result);
248 #else /* HAVE_GETIFADDRS */ 248 #else /* HAVE_GETIFADDRS && HAVE_INET_NTOP */
249 GList *result = NULL; 249 GList *result = NULL;
250 int source = socket(PF_INET,SOCK_STREAM, 0); 250 int source = socket(PF_INET,SOCK_STREAM, 0);
251 char buffer[1024]; 251 char buffer[1024];
252 char *tmp; 252 char *tmp;
253 struct ifconf ifc; 253 struct ifconf ifc;
277 } 277 }
278 } 278 }
279 } 279 }
280 280
281 return result; 281 return result;
282 #endif /* HAVE_GETIFADDRS */ 282 #endif /* HAVE_GETIFADDRS && HAVE_INET_NTOP */
283 } 283 }
284 284
285 const char * 285 const char *
286 purple_network_get_my_ip(int fd) 286 purple_network_get_my_ip(int fd)
287 { 287 {