aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-07-21 03:06:07 +0000
committerYang Tse <yangsita@gmail.com>2008-07-21 03:06:07 +0000
commit1b37baf6568e37d52601231c45e6394a3d0ff55b (patch)
tree1085842fa9ad6bb6f9dda01033d2414dd43c9850 /tests
parentbffe69a151bbd1aae72e50c128fdb0c58596ade1 (diff)
Use the sreadfrom() wrapper to replace recvfrom() in our code.
Diffstat (limited to 'tests')
-rw-r--r--tests/server/tftpd.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index bafe47cf6..67daa15ac 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 socklen_t fromlen;
+static RECVFROM_ARG6_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;
- socklen_t fromaddrlen;
+ RECVFROM_ARG6_T fromaddrlen;
while (1) {
#if defined(HAVE_IOCTLSOCKET)
@@ -365,9 +365,8 @@ static int synchnet(curl_socket_t f /* socket to flush */)
#endif
if (i) {
j++;
- fromaddrlen = sizeof fromaddr;
- (void) recvfrom(f, rbuf, sizeof (rbuf), 0,
- (struct sockaddr *)&fromaddr, &fromaddrlen);
+ fromaddrlen = (RECVFROM_ARG6_T)sizeof(fromaddr);
+ (void)sreadfrom(f, rbuf, sizeof(rbuf), &fromaddr, &fromaddrlen);
}
else
break;
@@ -407,7 +406,7 @@ int main(int argc, char **argv)
#endif /* ENABLE_IPV6 */
struct tftphdr *tp;
- int n = 0;
+ ssize_t n = 0;
int arg = 1;
char *pidname= (char *)".tftpd.pid";
unsigned short port = DEFAULT_PORT;
@@ -514,9 +513,8 @@ int main(int argc, char **argv)
, port );
do {
- fromlen = sizeof(from);
- n = recvfrom(sock, buf, sizeof (buf), 0,
- (struct sockaddr *)&from, &fromlen);
+ fromlen = (RECVFROM_ARG6_T)sizeof(from);
+ n = sreadfrom(sock, buf, sizeof(buf), &from, &fromlen);
if (n < 0) {
logmsg("recvfrom:\n");
result = 3;