1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-31 02:36:12 +02:00

mingw: load system libraries the recommended way

When we access IPv6-related functions, we load the corresponding system
library using the `LoadLibrary()` function, which is not the recommended
way to load system libraries.

In practice, it does not make a difference: the `ws2_32.dll` library
containing the IPv6 functions is already loaded into memory, so
LoadLibrary() simply reuses the already-loaded library.

Still, recommended way is recommended way, so let's use that instead.

While at it, also adjust the code in contrib/ that loads system libraries.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2018-10-23 03:51:49 -07:00 committed by Junio C Hamano
parent c4df23f792
commit c6f050a434
2 changed files with 4 additions and 2 deletions

View File

@ -1577,7 +1577,8 @@ static void ensure_socket_initialization(void)
WSAGetLastError());
for (name = libraries; *name; name++) {
ipv6_dll = LoadLibrary(*name);
ipv6_dll = LoadLibraryExA(*name, NULL,
LOAD_LIBRARY_SEARCH_SYSTEM32);
if (!ipv6_dll)
continue;

View File

@ -75,7 +75,8 @@ static CredDeleteWT CredDeleteW;
static void load_cred_funcs(void)
{
/* load DLLs */
advapi = LoadLibrary("advapi32.dll");
advapi = LoadLibraryExA("advapi32.dll", NULL,
LOAD_LIBRARY_SEARCH_SYSTEM32);
if (!advapi)
die("failed to load advapi32.dll");