comparison src/process.c @ 85362:b949ffc47cba

Link to libs for calling res_init() if available. (Fmake_network_process): Call res_init() before getaddrinfo or gethostbyname, if possible.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 17 Oct 2007 15:57:30 +0000
parents 143bf32d4d58
children f7d19cfed7da
comparison
equal deleted inserted replaced
85361:26f0746bead1 85362:b949ffc47cba
117 #include <sys/sysmacros.h> /* for "minor" */ 117 #include <sys/sysmacros.h> /* for "minor" */
118 #endif /* not IRIS */ 118 #endif /* not IRIS */
119 119
120 #ifdef HAVE_SYS_WAIT 120 #ifdef HAVE_SYS_WAIT
121 #include <sys/wait.h> 121 #include <sys/wait.h>
122 #endif
123
124 #ifdef HAVE_RES_INIT
125 #include <netinet/in.h>
126 #include <arpa/nameser.h>
127 #include <resolv.h>
122 #endif 128 #endif
123 129
124 #include "lisp.h" 130 #include "lisp.h"
125 #include "systime.h" 131 #include "systime.h"
126 #include "systty.h" 132 #include "systty.h"
3081 memset (&hints, 0, sizeof (hints)); 3087 memset (&hints, 0, sizeof (hints));
3082 hints.ai_flags = 0; 3088 hints.ai_flags = 0;
3083 hints.ai_family = family; 3089 hints.ai_family = family;
3084 hints.ai_socktype = socktype; 3090 hints.ai_socktype = socktype;
3085 hints.ai_protocol = 0; 3091 hints.ai_protocol = 0;
3092
3093 #ifdef HAVE_RES_INIT
3094 res_init ();
3095 #endif
3096
3086 ret = getaddrinfo (SDATA (host), portstring, &hints, &res); 3097 ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
3087 if (ret) 3098 if (ret)
3088 #ifdef HAVE_GAI_STRERROR 3099 #ifdef HAVE_GAI_STRERROR
3089 error ("%s/%s %s", SDATA (host), portstring, gai_strerror(ret)); 3100 error ("%s/%s %s", SDATA (host), portstring, gai_strerror(ret));
3090 #else 3101 #else
3126 3137
3127 /* gethostbyname may fail with TRY_AGAIN, but we don't honour that, 3138 /* gethostbyname may fail with TRY_AGAIN, but we don't honour that,
3128 as it may `hang' Emacs for a very long time. */ 3139 as it may `hang' Emacs for a very long time. */
3129 immediate_quit = 1; 3140 immediate_quit = 1;
3130 QUIT; 3141 QUIT;
3142
3143 #ifdef HAVE_RES_INIT
3144 res_init ();
3145 #endif
3146
3131 host_info_ptr = gethostbyname (SDATA (host)); 3147 host_info_ptr = gethostbyname (SDATA (host));
3132 immediate_quit = 0; 3148 immediate_quit = 0;
3133 3149
3134 if (host_info_ptr) 3150 if (host_info_ptr)
3135 { 3151 {