From 124e38aa38c6d4b14d370a034f512a69fe34e38a Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 9 Jun 2014 23:57:14 +0200
Subject: [PATCH] Curl_done: skip the progress callback update on errors

When called with an CURLE_ABORTED_BY_CALLBACK error code, we're shutting
down forced by progress function (or other) callback and we must not
call the progress function again.

Bug: http://curl.haxx.se/mail/lib-2014-06/0062.html
Reported by: Jonathan Cardoso Machado
---
 lib/url.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/url.c b/lib/url.c
index fba3bd3..d4edffc 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -5808,11 +5808,11 @@ CURLcode Curl_done(struct connectdata **connp,
   if(conn->handler->done)
     result = conn->handler->done(conn, status, premature);
   else
     result = CURLE_OK;
 
-  if(Curl_pgrsDone(conn) && !result)
+  if((status != CURLE_ABORTED_BY_CALLBACK) && 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 */
   if(data->state.tempwrite) {
-- 
2.0.0

