mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
use the existing variable instead
This commit is contained in:
parent
b22e03b2b2
commit
5c8b973d4f
11
lib/tftp.c
11
lib/tftp.c
@ -306,7 +306,8 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
|
|||||||
if(data->set.upload) {
|
if(data->set.upload) {
|
||||||
/* If we are uploading, send an WRQ */
|
/* If we are uploading, send an WRQ */
|
||||||
setpacketevent(&state->spacket, TFTP_EVENT_WRQ);
|
setpacketevent(&state->spacket, TFTP_EVENT_WRQ);
|
||||||
state->conn->data->reqdata.upload_fromhere = (char *)&state->spacket.data[4];
|
state->conn->data->reqdata.upload_fromhere =
|
||||||
|
(char *)&state->spacket.data[4];
|
||||||
if(data->set.infilesize != -1)
|
if(data->set.infilesize != -1)
|
||||||
Curl_pgrsSetUploadSize(data, data->set.infilesize);
|
Curl_pgrsSetUploadSize(data, data->set.infilesize);
|
||||||
}
|
}
|
||||||
@ -722,7 +723,7 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
|||||||
if(code)
|
if(code)
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
state = (tftp_state_data_t *)conn->data->reqdata.proto.tftp;
|
state = (tftp_state_data_t *)data->reqdata.proto.tftp;
|
||||||
|
|
||||||
code = Curl_readwrite_init(conn);
|
code = Curl_readwrite_init(conn);
|
||||||
if(code)
|
if(code)
|
||||||
@ -765,7 +766,7 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
/* Sanity check packet length */
|
/* Sanity check packet length */
|
||||||
if(state->rbytes < 4) {
|
if(state->rbytes < 4) {
|
||||||
failf(conn->data, "Received too short packet\n");
|
failf(data, "Received too short packet\n");
|
||||||
/* Not a timeout, but how best to handle it? */
|
/* Not a timeout, but how best to handle it? */
|
||||||
event = TFTP_EVENT_TIMEOUT;
|
event = TFTP_EVENT_TIMEOUT;
|
||||||
}
|
}
|
||||||
@ -790,14 +791,14 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
|||||||
break;
|
break;
|
||||||
case TFTP_EVENT_ERROR:
|
case TFTP_EVENT_ERROR:
|
||||||
state->error = (tftp_error_t)getrpacketblock(&state->rpacket);
|
state->error = (tftp_error_t)getrpacketblock(&state->rpacket);
|
||||||
infof(conn->data, "%s\n", (char *)&state->rpacket.data[4]);
|
infof(data, "%s\n", (char *)&state->rpacket.data[4]);
|
||||||
break;
|
break;
|
||||||
case TFTP_EVENT_ACK:
|
case TFTP_EVENT_ACK:
|
||||||
break;
|
break;
|
||||||
case TFTP_EVENT_RRQ:
|
case TFTP_EVENT_RRQ:
|
||||||
case TFTP_EVENT_WRQ:
|
case TFTP_EVENT_WRQ:
|
||||||
default:
|
default:
|
||||||
failf(conn->data, "%s\n", "Internal error: Unexpected packet");
|
failf(data, "%s\n", "Internal error: Unexpected packet");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user