summary refs log tree commit diff
path: root/sunrpc/clnt_simp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc/clnt_simp.c')
-rw-r--r--sunrpc/clnt_simp.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/sunrpc/clnt_simp.c b/sunrpc/clnt_simp.c
index d612df09a0..0ecb64ca7b 100644
--- a/sunrpc/clnt_simp.c
+++ b/sunrpc/clnt_simp.c
@@ -61,7 +61,6 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
   struct callrpc_private_s *crp = callrpc_private;
   struct sockaddr_in server_addr;
   enum clnt_stat clnt_stat;
-  struct hostent hostbuf, *hp;
   struct timeval timeout, tottimeout;
 
   if (crp == 0)
@@ -84,10 +83,6 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
     }
   else
     {
-      size_t buflen;
-      char *buffer;
-      int herr;
-
       crp->valid = 0;
       if (crp->socket != RPC_ANYSOCK)
 	{
@@ -100,25 +95,11 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
 	  crp->client = NULL;
 	}
 
-      buflen = 1024;
-      buffer = __alloca (buflen);
-      while (__gethostbyname_r (host, &hostbuf, buffer, buflen,
-				&hp, &herr) != 0
-	     || hp == NULL)
-	if (herr != NETDB_INTERNAL || errno != ERANGE)
-	  return (int) RPC_UNKNOWNHOST;
-	else
-	  {
-	    /* Enlarge the buffer.  */
-	    buflen *= 2;
-	    buffer = __alloca (buflen);
-	  }
+      if (__libc_rpc_gethostbyname (host, &server_addr) != 0)
+	return (int) get_rpc_createerr().cf_stat;
 
       timeout.tv_usec = 0;
       timeout.tv_sec = 5;
-      memcpy ((char *) &server_addr.sin_addr, hp->h_addr, hp->h_length);
-      server_addr.sin_family = AF_INET;
-      server_addr.sin_port = 0;
       if ((crp->client = clntudp_create (&server_addr, (u_long) prognum,
 			  (u_long) versnum, timeout, &crp->socket)) == NULL)
 	return (int) get_rpc_createerr().cf_stat;