aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-12-06 05:20:05 +0100
committerYang Tse <yangsita@gmail.com>2010-12-06 14:29:16 +0100
commitbf1c102b80698e60972063b269f61ccbe2bfeaa8 (patch)
tree7eb6c9c8e8c73e7df757beb392870383ce7422b6
parent2271b60b71c4e6d3337ddde0fae81ad6bb6fe2c3 (diff)
ssh: fix a download resume point calculation
-rw-r--r--lib/ssh.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index d432b4ec4..81f5f6420 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -1439,7 +1439,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(data->state.resume_from != 0) {
LIBSSH2_SFTP_ATTRIBUTES attrs;
- if(data->state.resume_from< 0) {
+ if(data->state.resume_from < 0) {
rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path,
(unsigned int)strlen(sftp_scp->path),
LIBSSH2_SFTP_STAT, &attrs);
@@ -1563,7 +1563,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
/* now, decrease the size of the read */
- if(data->set.infilesize>0) {
+ if(data->set.infilesize > 0) {
data->set.infilesize -= data->state.resume_from;
data->req.size = data->set.infilesize;
Curl_pgrsSetUploadSize(data, data->set.infilesize);
@@ -1571,7 +1571,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);
}
- if(data->set.infilesize>0) {
+ if(data->set.infilesize > 0) {
data->req.size = data->set.infilesize;
Curl_pgrsSetUploadSize(data, data->set.infilesize);
}
@@ -1966,7 +1966,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
/* We can resume if we can seek to the resume position */
if(data->state.resume_from) {
- if(data->state.resume_from< 0) {
+ if(data->state.resume_from < 0) {
/* We're supposed to download the last abs(from) bytes */
if((curl_off_t)attrs.filesize < -data->state.resume_from) {
failf(data, "Offset (%"
@@ -1975,7 +1975,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
return CURLE_BAD_DOWNLOAD_RESUME;
}
/* download from where? */
- data->state.resume_from = attrs.filesize - data->state.resume_from;
+ data->state.resume_from += attrs.filesize;
}
else {
if((curl_off_t)attrs.filesize < data->state.resume_from) {