diff options
author | Yang Tse <yangsita@gmail.com> | 2008-07-30 05:10:42 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-07-30 05:10:42 +0000 |
commit | 537490e391157f47ccf2957e123019d9356dbe94 (patch) | |
tree | 57fb44831f4d147c24e1deb358ba84b95441ebfd | |
parent | de8e362d4a31b707c81420536a3da3efa72903cb (diff) |
Undo using the sreadfrom() wrapper to replace recvfrom() in our code.
-rw-r--r-- | lib/tftp.c | 13 | ||||
-rw-r--r-- | tests/server/tftpd.c | 14 |
2 files changed, 16 insertions, 11 deletions
diff --git a/lib/tftp.c b/lib/tftp.c index 449a2b3d2..8478fd6f9 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -717,7 +717,7 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done) CURLcode code; int rc; struct Curl_sockaddr_storage fromaddr; - RECVFROM_ARG6_T fromlen; + socklen_t fromlen; int check_time = 0; struct SingleRequest *k = &data->req; @@ -764,10 +764,13 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done) else { /* Receive the packet */ - fromlen = (RECVFROM_ARG6_T)sizeof(fromaddr); - state->rbytes = sreadfrom(state->sockfd, - &state->rpacket, sizeof(state->rpacket), - &fromaddr, &fromlen); + fromlen = sizeof(fromaddr); + state->rbytes = (ssize_t)recvfrom(state->sockfd, + (void *)&state->rpacket, + sizeof(state->rpacket), + 0, + (struct sockaddr *)&fromaddr, + &fromlen); if(state->remote_addrlen==0) { memcpy(&state->remote_addr, &fromaddr, fromlen); state->remote_addrlen = fromlen; diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index c50ea1949..0fe18a2c7 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -132,7 +132,7 @@ static int maxtimeout = 5*TIMEOUT; static char buf[PKTSIZE]; static char ackbuf[PKTSIZE]; static struct sockaddr_in from; -static RECVFROM_ARG6_T fromlen; +static socklen_t fromlen; struct bf { int counter; /* size of data in buffer, or flag */ @@ -355,7 +355,7 @@ static int synchnet(curl_socket_t f /* socket to flush */) int j = 0; char rbuf[PKTSIZE]; struct sockaddr_in fromaddr; - RECVFROM_ARG6_T fromaddrlen; + socklen_t fromaddrlen; while (1) { #if defined(HAVE_IOCTLSOCKET) @@ -365,8 +365,9 @@ static int synchnet(curl_socket_t f /* socket to flush */) #endif if (i) { j++; - fromaddrlen = (RECVFROM_ARG6_T)sizeof(fromaddr); - (void)sreadfrom(f, rbuf, sizeof(rbuf), &fromaddr, &fromaddrlen); + fromaddrlen = sizeof(fromaddr); + (void)recvfrom(f, rbuf, sizeof(rbuf), 0, + (struct sockaddr *)&fromaddr, &fromaddrlen); } else break; @@ -513,8 +514,9 @@ int main(int argc, char **argv) , port ); do { - fromlen = (RECVFROM_ARG6_T)sizeof(from); - n = sreadfrom(sock, buf, sizeof(buf), &from, &fromlen); + fromlen = sizeof(from); + n = (ssize_t)sreadfrom(sock, buf, sizeof(buf), 0, + (struct sockaddr *)&from, &fromlen); if (n < 0) { logmsg("recvfrom:\n"); result = 3; |