Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added error checking for curl_global_init().

  • Loading branch information...
commit 6e3802a2cfde2edaabef902d494dea58d77f6d5b 1 parent df5a47b
Guenter Knauf authored July 12, 2012

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  docs/examples/post-callback.c
8  docs/examples/post-callback.c
@@ -61,7 +61,13 @@ int main(void)
61 61
   pooh.sizeleft = strlen(data);
62 62
 
63 63
   /* In windows, this will init the winsock stuff */
64  
-  curl_global_init(CURL_GLOBAL_DEFAULT);
  64
+  res = curl_global_init(CURL_GLOBAL_DEFAULT);
  65
+  /* Check for errors */
  66
+  if(res != CURLE_OK) {
  67
+    fprintf(stderr, "curl_global_init() failed: %s\n",
  68
+            curl_easy_strerror(res));
  69
+    return 1;
  70
+  }
65 71
 
66 72
   /* get a curl handle */
67 73
   curl = curl_easy_init();

0 notes on commit 6e3802a

Please sign in to comment.
Something went wrong with that request. Please try again.