curl-library
[PATCH] examples/getinmemory.c: abort the transfer if not enough memory
Date: Sun, 24 Feb 2013 18:36:50 +0100
Hi,
So far the getinmemory.c example terminates the process with an EXIT_FAILURE status code if the in-memory growing buffer cannot be reallocated.
Since the write function includes the ability to signal an error to libcurl [1], and let it abort the transfer with a CURLE_WRITE_ERROR, I thought it would be better to use it as a best practice within this example.
Please find attached a (small) patch that avoids using exit(3). In addition there is a 2nd patch that sets the CURLOPT_FOLLOWLOCATION option since example.com includes redirections.
Cédric
[1] http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTWRITEFUNCTION
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-02-24