]> granicus.if.org Git - curl/commitdiff
Added error checking for curl_global_init().
authorGuenter Knauf <lists@gknw.net>
Thu, 12 Jul 2012 13:18:00 +0000 (15:18 +0200)
committerGuenter Knauf <lists@gknw.net>
Thu, 12 Jul 2012 13:18:00 +0000 (15:18 +0200)
docs/examples/post-callback.c

index fa0c4b68699a937e0ab0c1e42acdf56a55323bac..f11fb983bf0a30b12a9f41f536a8ead0c1a83eb0 100644 (file)
@@ -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();