]> git.eshelyaron.com Git - emacs.git/commitdiff
Link to libs for calling res_init() if available.
authorChong Yidong <cyd@stupidchicken.com>
Wed, 17 Oct 2007 15:57:30 +0000 (15:57 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Wed, 17 Oct 2007 15:57:30 +0000 (15:57 +0000)
(Fmake_network_process): Call res_init() before getaddrinfo or
gethostbyname, if possible.

src/process.c

index 19275e40db52d715a0de17aa6ef5fe8153284a7c..6749ebda11729af90c74b6fbd0050bd6421d49d7 100644 (file)
@@ -121,6 +121,12 @@ Boston, MA 02110-1301, USA.  */
 #include <sys/wait.h>
 #endif
 
+#ifdef HAVE_RES_INIT
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+#endif
+
 #include "lisp.h"
 #include "systime.h"
 #include "systty.h"
@@ -3083,6 +3089,11 @@ usage: (make-network-process &rest ARGS)  */)
       hints.ai_family = family;
       hints.ai_socktype = socktype;
       hints.ai_protocol = 0;
+
+#ifdef HAVE_RES_INIT
+      res_init ();
+#endif
+
       ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
       if (ret)
 #ifdef HAVE_GAI_STRERROR
@@ -3128,6 +3139,11 @@ usage: (make-network-process &rest ARGS)  */)
         as it may `hang' Emacs for a very long time.  */
       immediate_quit = 1;
       QUIT;
+
+#ifdef HAVE_RES_INIT
+      res_init ();
+#endif
+
       host_info_ptr = gethostbyname (SDATA (host));
       immediate_quit = 0;