cURL / Mailing Lists / curl-library / Single Mail

curl-library

ftpget.c example error

From: Avi Manor <amanor_at_Airspan.com>
Date: Wed, 28 Mar 2012 10:32:47 +0200

The code introduced in http://curl.haxx.se/libcurl/c/ftpget.html includes an error in my_fwrite function.

This function returns the value returned by fwrite. This value is nmemb.

However, the documentation of CURLOPT_WRITEFUNCTION says: "Return the number of bytes actually taken care of" this number is: "The size of the data pointed to by ptr is size multiplied with nmemb".

So my_fwrite should return (size * nmemb). After verifying that fwrite had returned the same value as nmemb.

While testing this example I have noticed that every call to my_fwrite comes with size = 1. This is the reason why the error is unnoticeable. However, it is not guaranteed to get every call with size = 1.

Avi Manor Airspan Networks Inc.

[cid:airspanlogo]<http://www.airspan.com>

Follow Airspan: [cid:facebook] <http://www.facebook.com/pages/Airspan-Networks-Inc/146547872063552?v=wall> [cid:twitter] <http://twitter.com/airspannetworks>

This e-mail and any attachments may contain confidential and privileged information and are intended solely for the intended recipient (s). If you are not the intended recipient (s), please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient (s) is unauthorized and may be illegal. Airspan makes no representations or warranties whatsoever about the content of this e-mail, its accuracy, completeness, security or freedom from viruses.wmbt

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

airspanlogo
facebook
twitter
Received on 2012-03-28