summaryrefslogtreecommitdiff
path: root/lib/tftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-05-18 10:32:48 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-05-18 10:32:48 +0000
commit250f9670b72637a2cdca49d6ac5656c6f58235fd (patch)
treead5e49e72a94b902a331ef31c79fc26823afb8d8 /lib/tftp.c
parented4936fd30122d142e89f11518b2f3bc66fea721 (diff)
downloadcurl-250f9670b72637a2cdca49d6ac5656c6f58235fd.tar.gz
Feng Tu reported that curl -w did wrong on TFTP transfers in
bug report #1715394 (http://curl.haxx.se/bug/view.cgi?id=1715394), and the transfer-related info "variables" were indeed overwritten with zeroes wrongly and have now been adjusted. The upload size still isn't accurate.
Diffstat (limited to 'lib/tftp.c')
-rw-r--r--lib/tftp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/tftp.c b/lib/tftp.c
index 038306d86..9104d605c 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -415,8 +415,6 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
return CURLE_TFTP_ILLEGAL; /* not really the perfect return code for
this */
}
- Curl_pgrsSetDownloadCounter(data,
- (curl_off_t) state->block*TFTP_BLOCKSIZE);
return CURLE_OK;
}
@@ -485,6 +483,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
/* Check all sbytes were sent */
if(sbytes<0) {
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
+ return CURLE_SEND_ERROR;
}
break;
@@ -497,7 +496,8 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
if(state->retries > state->retry_max) {
state->error = TFTP_ERR_TIMEOUT;
state->state = TFTP_STATE_FIN;
- } else {
+ }
+ else {
/* Re-send the data packet */
sbytes = sendto(state->sockfd, (void *)&state->spacket,
4+state->sbytes, SEND_4TH_ARG,
@@ -506,6 +506,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
/* Check all sbytes were sent */
if(sbytes<0) {
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
+ return CURLE_SEND_ERROR;
}
}
break;
@@ -738,6 +739,8 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done)
state->rbytes-4);
if(code)
return code;
+ Curl_pgrsSetDownloadCounter(data,
+ (curl_off_t) state->rbytes-4);
}
break;
case TFTP_EVENT_ERROR: