]> git.ipfire.org Git - thirdparty/curl.git/commit
hostip.c: Move macOS-specific calls into global init call
authorStan Hu <stanhu@gmail.com>
Mon, 5 Jun 2023 17:05:48 +0000 (10:05 -0700)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 9 Jul 2023 17:16:58 +0000 (19:16 +0200)
commitc7308592fb8ba213fc2c1bb6ad39781df45bd84a
tree22cf6bce8259da107c32ae48ac08b8435f9de2f3
parent22c92a6d5176dd62c1c7f6af5007fab5ee444600
hostip.c: Move macOS-specific calls into global init call

https://github.com/curl/curl/pull/7121 introduced a macOS system call
to `SCDynamicStoreCopyProxies`, which is invoked every time an IP
address needs to be resolved.

However, this system call is not thread-safe, and macOS will kill the
process if the system call is run first in a fork. To make it possible
for the parent process to call this once and prevent the crash, only
invoke this system call in the global initialization routine.

In addition, this change is beneficial because it:

1. Avoids extra macOS system calls for every IP lookup.
2. Consolidates macOS-specific initialization in a separate file.

Fixes #11252
Closes #11254
lib/Makefile.inc
lib/easy.c
lib/hostip.c
lib/macos.c [new file with mode: 0644]
lib/macos.h [new file with mode: 0644]