cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Bug: curl doesn't notice ENOSPACE if it writes a small amount of data.

From: Björn Augustsson <oggust_at_gmail.com>
Date: Mon, 23 Nov 2009 18:01:16 +0100

On Mon, Nov 23, 2009 at 15:00, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 23 Nov 2009, Björn Augustsson wrote:
>
>> $ curl -o short  google.com
>>  % Total    % Received % Xferd  Average Speed   Time    Time     Time
>>  Current
>>                                Dload  Upload   Total   Spent    Left
>>  Speed
>> 109   219  109   219    0     0    571      0 --:--:-- --:--:-- --:--:--
>>  1183
>> $
>>
>> ##   So... All went well? Nope:
>
> Thanks for this report.
>
> I managed to repeat it exactly as you mentioned. And you know what? fwrite()
> returns a successful return code on that single 219 byte write, so libcurl
> doesn't discover any problem!
>
> With strace we can see that the underlying write() function gets a -1
> (ENOSPACE) back, but that doesn't help us much...
>
> The fix turned out to be that we didn't do the proper error-checking on the
> fclose() call, which got the error reported. While fixing this, I noticed a
> similarly lack of error check on a fflush() call that I also added while
> editing the code.
>
> So, the version in CVS now detects this failure and reports it!

Great, thanks for the very fast ( <1h! ) fix!

/August.

-- 
Wrong on most accounts.  const Foo *foo; and Foo const *foo; mean the same: foo
being a pointer to const Foo.  const Foo const *foo; would mean the same but is
illegal (double const).  You are confusing this with Foo * const foo; and const
Foo * const foo; respectively. -David Kastrup, comp.os.linux.development.system
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-23