]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
unit1620: call global_init before calling Curl_open
authorGisle Vanem <gisle.vanem@gmail.com>
Mon, 18 Apr 2022 06:45:14 +0000 (02:45 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Wed, 20 Apr 2022 06:26:43 +0000 (02:26 -0400)
Curl_open calls the resolver init and on Windows if the resolver backend
is c-ares then the Windows sockets library (winsock) must already have
been initialized (via global init).

Ref: https://github.com/curl/curl/pull/8540#issuecomment-1059771800

Closes https://github.com/curl/curl/pull/8719

tests/unit/unit1620.c

index 4f1aaaf0aaba7050e372526982ba7bae7ffa5cf6..fc25eac37fc2d5e9e2160b899bb4778181f43fa8 100644 (file)
 
 static CURLcode unit_setup(void)
 {
-  return CURLE_OK;
+  int res = CURLE_OK;
+  global_init(CURL_GLOBAL_ALL);
+  return res;
 }
 
 static void unit_stop(void)
 {
+  curl_global_cleanup();
 }
 
 UNITTEST_START