From 92b6026fa55eb1a6d76dfa549e173fc7b863dda5 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 17 Jul 2017 05:23:45 -0500 Subject: Split out xgetaddrinfo() from xconnect() --- toys/net/ftpget.c | 3 ++- toys/other/nbd_client.c | 2 +- toys/pending/telnet.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'toys') diff --git a/toys/net/ftpget.c b/toys/net/ftpget.c index 94e5caed..3c63905e 100644 --- a/toys/net/ftpget.c +++ b/toys/net/ftpget.c @@ -107,7 +107,8 @@ void ftpget_main(void) if (!remote) remote = toys.optargs[1]; // connect - TT.fd = xconnect(*toys.optargs, TT.port, 0, SOCK_STREAM, 0, AI_ADDRCONFIG); + TT.fd = xconnect(xgetaddrifo(*toys.optargs, TT.port, 0, SOCK_STREAM, 0, + AI_ADDRCONFIG)); if (getpeername(TT.fd, (void *)&si6, &sl)) perror_exit("getpeername"); // Login diff --git a/toys/other/nbd_client.c b/toys/other/nbd_client.c index 3ad366f3..fcd0fca8 100644 --- a/toys/other/nbd_client.c +++ b/toys/other/nbd_client.c @@ -52,7 +52,7 @@ void nbd_client_main(void) // Find and connect to server - sock = xconnect(host, port, AF_UNSPEC, SOCK_STREAM, 0, 0); + sock = xconnect(xgetaddrinfo(host, port, AF_UNSPEC, SOCK_STREAM, 0, 0)); temp = 1; setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &temp, sizeof(int)); diff --git a/toys/pending/telnet.c b/toys/pending/telnet.c index dc3487a5..e37b982c 100644 --- a/toys/pending/telnet.c +++ b/toys/pending/telnet.c @@ -306,7 +306,8 @@ void telnet_main(void) } terminal_size(&TT.win_width, &TT.win_height); - TT.sfd = xconnect(*toys.optargs, port, 0, SOCK_STREAM, IPPROTO_TCP, 0); + TT.sfd = xconnect(xgetaddrinfo(*toys.optargs, port, 0, SOCK_STREAM, + IPPROTO_TCP, 0)); setsockopt(TT.sfd, SOL_SOCKET, SO_REUSEADDR, &set, sizeof(set)); setsockopt(TT.sfd, SOL_SOCKET, SO_KEEPALIVE, &set, sizeof(set)); -- cgit v1.2.3