aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/telnetd.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/pending/telnetd.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/pending/telnetd.c')
-rw-r--r--toys/pending/telnetd.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/toys/pending/telnetd.c b/toys/pending/telnetd.c
index 4198e63f..ad39d8c0 100644
--- a/toys/pending/telnetd.c
+++ b/toys/pending/telnetd.c
@@ -143,11 +143,8 @@ static int listen_socket(void)
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) == -1)
perror_exit("setsockopt");
- if (bind(s, (struct sockaddr *)buf, ((af == AF_INET)?
- (sizeof(struct sockaddr_in)):(sizeof(struct sockaddr_in6)))) == -1) {
- close(s);
- perror_exit("bind");
- }
+ xbind(s, (struct sockaddr *)buf, ((af == AF_INET)?
+ (sizeof(struct sockaddr_in)):(sizeof(struct sockaddr_in6))));
if (listen(s, 1) < 0) perror_exit("listen");
return s;