Permalink
Browse files

Added error checking for curl_global_init().

  • Loading branch information...
1 parent df5a47b commit 6e3802a2cfde2edaabef902d494dea58d77f6d5b @gknauf gknauf committed Jul 12, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 docs/examples/post-callback.c
@@ -61,7 +61,13 @@ int main(void)
pooh.sizeleft = strlen(data);
/* In windows, this will init the winsock stuff */
- curl_global_init(CURL_GLOBAL_DEFAULT);
+ res = curl_global_init(CURL_GLOBAL_DEFAULT);
+ /* Check for errors */
+ if(res != CURLE_OK) {
+ fprintf(stderr, "curl_global_init() failed: %s\n",
+ curl_easy_strerror(res));
+ return 1;
+ }
/* get a curl handle */
curl = curl_easy_init();

0 comments on commit 6e3802a

Please sign in to comment.