Blob Blame History Raw
--- bzflag-2.0.4.20050930/src/net/Address.cxx.lookup	2005-09-07 23:57:38.000000000 +0200
+++ bzflag-2.0.4.20050930/src/net/Address.cxx	2005-11-21 16:49:23.000000000 +0100
@@ -136,6 +136,8 @@
   int j;
 
   struct hostent* hent;
+  struct hostent myhostent;
+
   if (hname == "") {				// local address
     char hostname[MAXHOSTNAMELEN+1];
     if (gethostname(hostname, sizeof(hostname)) >= 0)
@@ -147,7 +149,21 @@
     a.addr.push_back(tempAddr);
     return a;
   } else {				// non-local address
-    hent = gethostbyname(hname.c_str());
+    // hent = gethostbyname(hname.c_str());
+    {
+      const char *hn = hname.c_str() ;
+      char  buf[1024] ;
+      int   my_herrno = 0;
+
+      memset(&myhostent, 0, sizeof(myhostent)) ;
+      hent = 0 ;
+
+      if(gethostbyname2_r (hn, AF_INET, &myhostent, buf,sizeof(buf),
+                           &hent, &my_herrno) != 0) {
+        sprintf(buf,"gethostbyname2_r failed %d", my_herrno) ;
+        printError(buf) ;
+      }
+    }
   }
 
   if (!hent) {