cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Probable bug in ftp_readresp()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 24 Aug 2009 13:16:13 +0200 (CEST)

On Fri, 21 Aug 2009, Patrick Monnerat wrote:

> I tried to change ftp.c lines 447-448:
>
> if (CURLE_OK != res)
> keepon = FALSE;
>
> into:
>
> if (CURLE_OK != res) {
> result = res;
> keepon = FALSE;
> }
>
> and it seems to do the job, but I'm not sure it does not break something
> else.

I think that sounds like a fine fix. If it unbreaks your breakage, please
commit!

It could even remove the assignment in the block just above it, like this:

--- lib/ftp.c 11 Aug 2009 20:43:12 -0000 1.526
+++ lib/ftp.c 24 Aug 2009 11:15:28 -0000
@@ -439,13 +439,15 @@
  #ifdef CURL_DOES_CONVERSIONS
        if((res == CURLE_OK) && (gotbytes > 0)) {
          /* convert from the network encoding */
- result = res = Curl_convert_from_network(data, ptr, gotbytes);
+ res = Curl_convert_from_network(data, ptr, gotbytes);
          /* Curl_convert_from_network calls failf if unsuccessful */
        }
  #endif /* CURL_DOES_CONVERSIONS */

- if(CURLE_OK != res)
+ if(CURLE_OK != res) {
+ result = res; /* set the outer result variable to this error */
          keepon = FALSE;
+ }
      }

      if(!keepon)

-- 
  / daniel.haxx.se
Received on 2009-08-24