Commit c5098080 authored by Brian Prodoehl's avatar Brian Prodoehl Committed by Jay Satiro
Browse files

curl_global_init: Check if IPv6 works

- Curl_ipv6works() is not thread-safe until after the first call, so
call it once during global init to avoid a possible race condition.

Bug: https://github.com/curl/curl/issues/915
PR: https://github.com/curl/curl/pull/918
parent 16fe3f6b
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -271,6 +271,8 @@ static CURLcode global_init(long flags, bool memoryfuncs)
    return CURLE_FAILED_INIT;
    return CURLE_FAILED_INIT;
  }
  }


  (void)Curl_ipv6works();

#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_INIT)
#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_INIT)
  if(libssh2_init(0)) {
  if(libssh2_init(0)) {
    DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n"));
    DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n"));