cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURL_EASY_PERFORM error but data transfer works

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 19 Feb 2015 15:10:33 -0500

On 2/18/2015 10:43 PM, Jon wrote:
>
> I have tested this on multiple occasions with the same error but yet
> things continue to work. Is this a documented benign error and/or can
> I ignore it? Or does it signal something more serious? Am I missing a
> setup call?
>
>

Also it occurs to me you're calling curl_global_init and
curl_global_cleanup multiple times. Neither one of those is thread safe.
Call init once at the start and cleanup once at the end. If you aren't
sure of the end you could use atexit right after you call global_init
like this
main(argc, argv) {
     if(curl_global_init(CURL_GLOBAL_ALL)) {
         fprintf(stderr, "Fatal: The initialization of libcurl has
failed.\n");
         return EXIT_FAILURE;
     }
     if(atexit(curl_global_cleanup)) {
         fprintf(stderr, "Fatal: atexit failed to register
curl_global_cleanup.\n");
         curl_global_cleanup();
         return EXIT_FAILURE;
     }
     your code
}

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-02-19