aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-07-30 05:10:42 +0000
committerYang Tse <yangsita@gmail.com>2008-07-30 05:10:42 +0000
commit537490e391157f47ccf2957e123019d9356dbe94 (patch)
tree57fb44831f4d147c24e1deb358ba84b95441ebfd
parentde8e362d4a31b707c81420536a3da3efa72903cb (diff)
Undo using the sreadfrom() wrapper to replace recvfrom() in our code.
-rw-r--r--lib/tftp.c13
-rw-r--r--tests/server/tftpd.c14
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;