You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by pq...@apache.org on 2009/11/27 18:41:56 UTC

svn commit: r884920 - /incubator/trafficserver/traffic/trunk/proxy/mgmt2/web2/WebCompatibility.cc

Author: pquerna
Date: Fri Nov 27 17:41:55 2009
New Revision: 884920

URL: http://svn.apache.org/viewvc?rev=884920&view=rev
Log:
TS-2: Use existing portable gethostbyaddr_r.

Modified:
    incubator/trafficserver/traffic/trunk/proxy/mgmt2/web2/WebCompatibility.cc

Modified: incubator/trafficserver/traffic/trunk/proxy/mgmt2/web2/WebCompatibility.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/proxy/mgmt2/web2/WebCompatibility.cc?rev=884920&r1=884919&r2=884920&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/proxy/mgmt2/web2/WebCompatibility.cc (original)
+++ incubator/trafficserver/traffic/trunk/proxy/mgmt2/web2/WebCompatibility.cc Fri Nov 27 17:41:55 2009
@@ -38,32 +38,14 @@
 char *
 WebGetHostname_Xmalloc(sockaddr_in * client_info)
 {
-
+  ink_gethostbyaddr_r_data data;
   char *hostname;
   char *hostname_tmp;
 
-#if (HOST_OS == linux)
-  // Why aren't we using the reentrant calls to gethostbyaddr? /leif
-  /*
-     struct hostent hostInfo;
-     char hostInfoBuf[256];
-     int _r_errno;
-     struct hostent *r = NULL;
-     struct hostent * addrp = NULL;
-
-     int res = gethostbyaddr_r((char*)&client_info->sin_addr.s_addr,
-     sizeof(client_info->sin_addr.s_addr), AF_INET,
-     &hostInfo, hostInfoBuf, 265, &addrp, &_r_errno);
-     if (!res && addrp) r = addrp;
-   */
-  struct hostent *r = gethostbyaddr((char *) &client_info->sin_addr.s_addr,
-                                    sizeof(client_info->sin_addr.s_addr),
-                                    AF_INET);
-#else
-  struct hostent *r = gethostbyaddr_r((char *) &client_info->sin_addr.s_addr,
-                                      sizeof(client_info->sin_addr.s_addr), AF_INET,
-                                      &hostInfo, hostInfoBuf, 265, &_r_errno);
-#endif
+  struct hostent *r = ink_gethostbyaddr_r((char *) &client_info->sin_addr.s_addr,
+                                          sizeof(client_info->sin_addr.s_addr),
+                                          AF_INET,
+                                          &data);
 
   hostname_tmp = r ? r->h_name : inet_ntoa(client_info->sin_addr);
   size_t len = strlen(hostname_tmp) + 1;