aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/setup_once.h7
-rw-r--r--lib/tftp.c14
2 files changed, 14 insertions, 7 deletions
diff --git a/lib/setup_once.h b/lib/setup_once.h
index 0e2d8bc12..e96f6984a 100644
--- a/lib/setup_once.h
+++ b/lib/setup_once.h
@@ -229,6 +229,13 @@ struct timeval {
#endif /* HAVE_RECVFROM */
+#ifdef RECVFROM_TYPE_ARG6_IS_VOID
+# define RECVFROM_ARG6_T unsigned int
+#else
+# define RECVFROM_ARG6_T RECVFROM_TYPE_ARG6
+#endif
+
+
/*
* Uppercase macro versions of ANSI/ISO is*() functions/macros which
* avoid negative number inputs with argument byte codes > 127.
diff --git a/lib/tftp.c b/lib/tftp.c
index ffd668c19..8ee947dfd 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -141,7 +141,7 @@ typedef struct tftp_state_data {
struct Curl_sockaddr_storage local_addr;
struct Curl_sockaddr_storage remote_addr;
socklen_t remote_addrlen;
- int rbytes;
+ ssize_t rbytes;
int sbytes;
tftp_packet_t rpacket;
tftp_packet_t spacket;
@@ -420,7 +420,7 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
}
/* Check if completed (That is, a less than full packet is received) */
- if(state->rbytes < (int)sizeof(state->spacket)){
+ if(state->rbytes < sizeof(state->spacket)){
state->state = TFTP_STATE_FIN;
}
else {
@@ -717,7 +717,7 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done)
CURLcode code;
int rc;
struct Curl_sockaddr_storage fromaddr;
- socklen_t fromlen;
+ RECVFROM_ARG6_T fromlen;
int check_time = 0;
struct SingleRequest *k = &data->req;
@@ -764,10 +764,10 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done)
else {
/* Receive the packet */
- fromlen=sizeof(fromaddr);
- state->rbytes = recvfrom(state->sockfd,
- (void *)&state->rpacket, sizeof(state->rpacket),
- 0, (struct sockaddr *)&fromaddr, &fromlen);
+ fromlen = (RECVFROM_ARG6_T)sizeof(fromaddr);
+ state->rbytes = sreadfrom(state->sockfd,
+ &state->rpacket, sizeof(state->rpacket),
+ &fromaddr, &fromlen);
if(state->remote_addrlen==0) {
memcpy(&state->remote_addr, &fromaddr, fromlen);
state->remote_addrlen = fromlen;