]> granicus.if.org Git - curl/commit
easy: fix win32 init to work without CURL_GLOBAL_WIN32
authorJay Satiro <raysatiro@yahoo.com>
Sat, 16 Feb 2019 23:55:40 +0000 (18:55 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Mon, 18 Feb 2019 07:12:12 +0000 (02:12 -0500)
commitf26bc29cfec0be84c67cf74065cf8e5e78fd68b7
treea98c016f45dba96cebb89792cbb98fa14d756620
parente6522522f96ad96b459e608c6cdcd46a32099b5b
easy: fix win32 init to work without CURL_GLOBAL_WIN32

- Change the behavior of win32_init so that the required initialization
  procedures are not affected by CURL_GLOBAL_WIN32 flag.

libcurl via curl_global_init supports initializing for win32 with an
optional flag CURL_GLOBAL_WIN32, which if omitted was meant to stop
Winsock initialization. It did so internally by skipping win32_init()
when that flag was set. Since then win32_init() has been expanded to
include required initialization routines that are separate from
Winsock and therefore must be called in all cases. This commit fixes
it so that CURL_GLOBAL_WIN32 only controls the optional win32
initialization (which is Winsock initialization, according to our doc).

The only users affected by this change are those that don't pass
CURL_GLOBAL_WIN32 to curl_global_init. For them this commit removes the
risk of a potential crash.

Ref: https://github.com/curl/curl/pull/3573

Fixes https://github.com/curl/curl/issues/3313
Closes https://github.com/curl/curl/pull/3575
lib/easy.c