comparison src/proxy.c @ 13425:95cc25e78ef6

[gaim-migrate @ 15800] #ifdef HAVE_GETADDRINFO instead of #if HAVE_GETADDRINFO to avoid warnings committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 07 Mar 2006 04:26:44 +0000
parents c74401cfef23
children 6ad9d666e824
comparison
equal deleted inserted replaced
13424:d52b9874c0de 13425:95cc25e78ef6
349 gaim_dns_resolverthread(int child_out, int child_in, gboolean show_debug) 349 gaim_dns_resolverthread(int child_out, int child_in, gboolean show_debug)
350 { 350 {
351 dns_params_t dns_params; 351 dns_params_t dns_params;
352 const size_t zero = 0; 352 const size_t zero = 0;
353 int rc; 353 int rc;
354 #if HAVE_GETADDRINFO 354 #ifdef HAVE_GETADDRINFO
355 struct addrinfo hints, *res, *tmp; 355 struct addrinfo hints, *res, *tmp;
356 char servname[20]; 356 char servname[20];
357 #else 357 #else
358 struct sockaddr_in sin; 358 struct sockaddr_in sin;
359 const size_t addrlen = sizeof(sin); 359 const size_t addrlen = sizeof(sin);
406 /* Tell our parent that we read the data successfully */ 406 /* Tell our parent that we read the data successfully */
407 write(child_out, &ch, sizeof(ch)); 407 write(child_out, &ch, sizeof(ch));
408 408
409 /* We have the hostname and port, now resolve the IP */ 409 /* We have the hostname and port, now resolve the IP */
410 410
411 #if HAVE_GETADDRINFO 411 #ifdef HAVE_GETADDRINFO
412 g_snprintf(servname, sizeof(servname), "%d", dns_params.port); 412 g_snprintf(servname, sizeof(servname), "%d", dns_params.port);
413 memset(&hints, 0, sizeof(hints)); 413 memset(&hints, 0, sizeof(hints));
414 414
415 /* This is only used to convert a service 415 /* This is only used to convert a service
416 * name to a port number. As we know we are 416 * name to a port number. As we know we are
636 636
637 rc = read(req->fd_out, &err, sizeof(err)); 637 rc = read(req->fd_out, &err, sizeof(err));
638 if ((rc == 4) && (err != 0)) 638 if ((rc == 4) && (err != 0))
639 { 639 {
640 char message[1024]; 640 char message[1024];
641 #if HAVE_GETADDRINFO 641 #ifdef HAVE_GETADDRINFO
642 g_snprintf(message, sizeof(message), "DNS error: %s (pid=%d)", 642 g_snprintf(message, sizeof(message), "DNS error: %s (pid=%d)",
643 gai_strerror(err), req->dns_pid); 643 gai_strerror(err), req->dns_pid);
644 #else 644 #else
645 g_snprintf(message, sizeof(message), "DNS error: %d (pid=%d)", 645 g_snprintf(message, sizeof(message), "DNS error: %d (pid=%d)",
646 err, req->dns_pid); 646 err, req->dns_pid);
782 return FALSE; 782 return FALSE;
783 } 783 }
784 784
785 static gpointer dns_thread(gpointer data) { 785 static gpointer dns_thread(gpointer data) {
786 786
787 #if HAVE_GETADDRINFO 787 #ifdef HAVE_GETADDRINFO
788 int rc; 788 int rc;
789 struct addrinfo hints, *res, *tmp; 789 struct addrinfo hints, *res, *tmp;
790 char servname[20]; 790 char servname[20];
791 #else 791 #else
792 struct sockaddr_in sin; 792 struct sockaddr_in sin;
793 struct hostent *hp; 793 struct hostent *hp;
794 #endif 794 #endif
795 dns_tdata *td = (dns_tdata*)data; 795 dns_tdata *td = (dns_tdata*)data;
796 796
797 #if HAVE_GETADDRINFO 797 #ifdef HAVE_GETADDRINFO
798 g_snprintf(servname, sizeof(servname), "%d", td->port); 798 g_snprintf(servname, sizeof(servname), "%d", td->port);
799 memset(&hints,0,sizeof(hints)); 799 memset(&hints,0,sizeof(hints));
800 800
801 /* This is only used to convert a service 801 /* This is only used to convert a service
802 * name to a port number. As we know we are 802 * name to a port number. As we know we are