From a57721d14642291696be4ffd5d8bb0915fbe861b Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 8 Jul 2019 16:02:56 -0700 Subject: 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. --- toys/pending/tftpd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'toys/pending/tftpd.c') diff --git a/toys/pending/tftpd.c b/toys/pending/tftpd.c index 9791ae41..b5d0558f 100644 --- a/toys/pending/tftpd.c +++ b/toys/pending/tftpd.c @@ -252,9 +252,8 @@ void tftpd_main(void) TT.sfd = xsocket(dstaddr.ss_family, SOCK_DGRAM, 0); if (setsockopt(TT.sfd, SOL_SOCKET, SO_REUSEADDR, (const void *)&set, sizeof(set)) < 0) perror_exit("setsockopt failed"); - if (bind(TT.sfd, (void *)&srcaddr, socklen)) perror_exit("bind"); - if (connect(TT.sfd, (void *)&dstaddr, socklen) < 0) - perror_exit("can't connect to remote host"); + xbind(TT.sfd, (void *)&srcaddr, socklen); + xconnect(TT.sfd, (void *)&dstaddr, socklen); // Error condition. if (recvmsg_len<4 || recvmsg_len>TFTPD_BLKSIZE || toybuf[recvmsg_len-1]) { send_errpkt((struct sockaddr*)&dstaddr, socklen, "packet format error"); -- cgit v1.2.3