]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
respect bits.close even if an error already is set, but make sure that the
authorDaniel Stenberg <daniel@haxx.se>
Wed, 19 Nov 2003 14:35:40 +0000 (14:35 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 19 Nov 2003 14:35:40 +0000 (14:35 +0000)
existing error is the one returned back

lib/url.c

index 6b0d191707a773ab637556ca7898cda939119045..2ee6c07223471d60116c0b2c306486a0edfa6b70 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -3236,9 +3236,15 @@ CURLcode Curl_done(struct connectdata *conn)
      if conn->bits.close is TRUE, it means that the connection should be
      closed in spite of all our efforts to be nice, due to protocol
      restrictions in our or the server's end */
-  if(data->set.reuse_forbid ||
-     ((CURLE_OK == result) && conn->bits.close))
-    result = Curl_disconnect(conn); /* close the connection */
+  if(data->set.reuse_forbid || conn->bits.close) {
+    CURLcode res2;
+    res2 = Curl_disconnect(conn); /* close the connection */
+
+    /* If we had an error already, make sure we return that one. But
+       if we got a new error, return that. */
+    if(!result && res2)
+      result = res2;
+  }
   else
     infof(data, "Connection #%d left intact\n", conn->connectindex);