summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2024-08-12 06:22:37 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2024-08-12 06:22:37 +0000
commit2cf697b5925f6e50d70bc0cb4d044dfb2c0ff085 (patch)
tree20060f1d83122ae91d162e77d9b07dc107c4a353
parent54d547ea0a9bb8ab408f0aabe5404a788b8d4236 (diff)
Get rid of inet_aton and simplify.
localhost is just a weird spelling of 127.0.0.1. OK bluhm
-rw-r--r--usr.bin/netstat/inet.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 88d37be055e..40345efb447 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.182 2024/04/17 20:48:51 bluhm Exp $ */
+/* $OpenBSD: inet.c,v 1.183 2024/08/12 06:22:36 florian Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
@@ -813,7 +813,6 @@ static char *
getrpcportnam(in_port_t port, int proto)
{
struct sockaddr_in server_addr;
- struct hostent *hp;
static struct pmaplist *head;
int socket = RPC_ANYSOCK;
struct timeval minutetimeout;
@@ -828,11 +827,7 @@ getrpcportnam(in_port_t port, int proto)
first = 1;
memset(&server_addr, 0, sizeof server_addr);
server_addr.sin_family = AF_INET;
- if ((hp = gethostbyname("localhost")) != NULL)
- memmove((caddr_t)&server_addr.sin_addr, hp->h_addr,
- hp->h_length);
- else
- (void) inet_aton("0.0.0.0", &server_addr.sin_addr);
+ (void) inet_pton(AF_INET, "127.0.0.1", &server_addr.sin_addr);
minutetimeout.tv_sec = 60;
minutetimeout.tv_usec = 0;