aboutsummaryrefslogtreecommitdiff
path: root/toys/net/ftpget.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-07-08 16:02:56 -0700
committerRob Landley <rob@landley.net>2019-07-11 22:02:12 -0500
commita57721d14642291696be4ffd5d8bb0915fbe861b (patch)
tree11a18894601df31ce1eb9c46c5d1faaa59e2f9e8 /toys/net/ftpget.c
parent34f095fcbf0829719f9a130a359ebf2a3e223ca0 (diff)
downloadtoybox-a57721d14642291696be4ffd5d8bb0915fbe861b.tar.gz
bind/connect cleanup.
Rename the existing xbind/xconnect to xbindany/xconnectany, to make room for new xbind/xconnect that are more like 'x' versions of the regular bind and connect. Move explicit bind/connect callers over to xbind/xconnect. Of the affected commands, only netcat is actually used by Android. It was the most recent patch to netcat that made the lack of a more traditional xbind/xconnect apparent.
Diffstat (limited to 'toys/net/ftpget.c')
-rw-r--r--toys/net/ftpget.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/net/ftpget.c b/toys/net/ftpget.c
index ad3c3030..05c53509 100644
--- a/toys/net/ftpget.c
+++ b/toys/net/ftpget.c
@@ -105,7 +105,7 @@ void ftpget_main(void)
if (!remote) remote = toys.optargs[1];
// connect
- TT.fd = xconnect(xgetaddrinfo(*toys.optargs, TT.p, 0, SOCK_STREAM, 0,
+ TT.fd = xconnectany(xgetaddrinfo(*toys.optargs, TT.p, 0, SOCK_STREAM, 0,
AI_ADDRCONFIG));
if (getpeername(TT.fd, (void *)&si6, &sl)) perror_exit("getpeername");
@@ -147,7 +147,7 @@ void ftpget_main(void)
if (!s || port<1 || port>65535) error_exit_raw(toybuf);
si6.sin6_port = SWAP_BE16(port); // same field size/offset for v4 and v6
port = xsocket(si6.sin6_family, SOCK_STREAM, 0);
- if (connect(port, (void *)&si6, sizeof(si6))) perror_exit("connect");
+ xconnect(port, (void *)&si6, sizeof(si6));
// RETR blocks until file data read from data port, so use SIZE to check
// if file exists before creating local copy