aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/progress.c12
-rw-r--r--lib/progress.h2
-rw-r--r--lib/ssh.c3
-rw-r--r--lib/tftp.c3
-rw-r--r--lib/url.c3
5 files changed, 17 insertions, 6 deletions
diff --git a/lib/progress.c b/lib/progress.c
index 4c9a63acb..e73f01811 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -131,11 +131,14 @@ static char *max5data(curl_off_t bytes, char *max5)
*/
-void Curl_pgrsDone(struct connectdata *conn)
+int Curl_pgrsDone(struct connectdata *conn)
{
+ int rc;
struct SessionHandle *data = conn->data;
data->progress.lastshow=0;
- Curl_pgrsUpdate(conn); /* the final (forced) update */
+ rc = Curl_pgrsUpdate(conn); /* the final (forced) update */
+ if(rc)
+ return rc;
if(!(data->progress.flags & PGRS_HIDE) &&
!data->progress.callback)
@@ -144,6 +147,7 @@ void Curl_pgrsDone(struct connectdata *conn)
fprintf(data->set.err, "\n");
data->progress.speeder_c = 0; /* reset the progress meter display */
+ return 0;
}
/* reset all times except redirect, and reset the known transfer sizes */
@@ -241,6 +245,10 @@ void Curl_pgrsSetUploadSize(struct SessionHandle *data, curl_off_t size)
data->progress.flags &= ~PGRS_UL_SIZE_KNOWN;
}
+/*
+ * Curl_pgrsUpdate() returns 0 for success or the value returned by the
+ * progress callback!
+ */
int Curl_pgrsUpdate(struct connectdata *conn)
{
struct timeval now;
diff --git a/lib/progress.h b/lib/progress.h
index a41d5f92f..951de7f94 100644
--- a/lib/progress.h
+++ b/lib/progress.h
@@ -39,7 +39,7 @@ typedef enum {
TIMER_LAST /* must be last */
} timerid;
-void Curl_pgrsDone(struct connectdata *);
+int Curl_pgrsDone(struct connectdata *);
void Curl_pgrsStartNow(struct SessionHandle *data);
void Curl_pgrsSetDownloadSize(struct SessionHandle *data, curl_off_t size);
void Curl_pgrsSetUploadSize(struct SessionHandle *data, curl_off_t size);
diff --git a/lib/ssh.c b/lib/ssh.c
index 90c8013c2..a1abc5b08 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -2820,7 +2820,8 @@ static CURLcode ssh_done(struct connectdata *conn, CURLcode status)
if(sftp_scp)
Curl_safefree(sftp_scp->path);
- Curl_pgrsDone(conn);
+ if(Curl_pgrsDone(conn))
+ return CURLE_ABORTED_BY_CALLBACK;
conn->data->req.keepon = 0; /* clear all bits */
return result;
diff --git a/lib/tftp.c b/lib/tftp.c
index 85404de8b..7202b94d3 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -1036,7 +1036,8 @@ static CURLcode tftp_done(struct connectdata *conn, CURLcode status,
(void)status; /* unused */
(void)premature; /* not used */
- Curl_pgrsDone(conn);
+ if(Curl_pgrsDone(conn))
+ return CURLE_ABORTED_BY_CALLBACK;
/* If we have encountered an error */
code = tftp_translate_code(state->error);
diff --git a/lib/url.c b/lib/url.c
index b78c200fa..88e169c98 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -5379,7 +5379,8 @@ CURLcode Curl_done(struct connectdata **connp,
else
result = CURLE_OK;
- Curl_pgrsDone(conn); /* done with the operation */
+ if(Curl_pgrsDone(conn) && !result)
+ result = CURLE_ABORTED_BY_CALLBACK;
/* if the transfer was completed in a paused state there can be buffered
data left to write and then kill */