cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: bug in curl_formget()

From: Aaron Orenstein <aorenste_at_gmail.com>
Date: Mon, 13 Jun 2011 12:51:05 -0400

On Mon, Jun 13, 2011 at 5:23 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Mon, 13 Jun 2011, Daniel Stenberg wrote:
>
> I haven't really understood how it comes that the file remains open
>>
>
> Scratch that. I instead suggest the following patch, can you check if this
> fixes the problem you experience?
>
>
>

Yes - that fixes it - although it seems a bit heavy-handed to me. I prefer
the way it was where the function that opened the file was the one that (was
supposed to) close it as well.

I still think the "nread > size" is incorrect - under what circumstance
(other than a misbehaving OS) would nread be larger than the requested
read? On the other hand a short read ("nread < size") is expected - and
matches the given comment.

You can test the problem without a windows machine by using a debugger and
breaking at the fclose() line and noting that with the given test case
fclose() is never called. Stepping through the code should give you a good
idea of what is going on.

- Aaron

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-13