aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-08-12 08:19:39 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-08-12 08:19:39 +0000
commit966cb698e61ded3600d0248ab55dde9a2fe0625c (patch)
tree96b0b4852f73a8b05c5c07cb63db05d06796a6ff /lib
parent4b44638f4d7d59c0f7d85a9a3a893c1a756f7695 (diff)
- Carsten Lange reported a bug and provided a patch for TFTP upload and the
sending of the TSIZE option. I don't like fixing bugs just hours before a release, but since it was broken and the patch fixes this for him I decided to get it in anyway.
Diffstat (limited to 'lib')
-rw-r--r--lib/tftp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/tftp.c b/lib/tftp.c
index 0a1dc59bd..fe55e9dfc 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -443,7 +443,7 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
size_t sbytes;
const char *mode = "octet";
char *filename;
- char buf[8];
+ char buf[64];
struct SessionHandle *data = state->conn->data;
CURLcode res = CURLE_OK;
@@ -489,11 +489,16 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
sbytes = 4 + strlen(filename) + strlen(mode);
/* add tsize option */
+ if(data->set.upload && (data->set.infilesize != -1))
+ snprintf( buf, sizeof(buf), "%" FORMAT_OFF_T, data->set.infilesize );
+ else
+ strcpy(buf, "0"); /* the destination is large enough */
+
sbytes += tftp_option_add(state, sbytes,
(char *)state->spacket.data+sbytes,
TFTP_OPTION_TSIZE);
sbytes += tftp_option_add(state, sbytes,
- (char *)state->spacket.data+sbytes, "0");
+ (char *)state->spacket.data+sbytes, buf);
/* add blksize option */
snprintf( buf, sizeof(buf), "%d", state->requested_blksize );
sbytes += tftp_option_add(state, sbytes,