From d5c42d70de2b8bbec31e67d2f178e2a0ce1539f3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 23 Nov 2018 13:17:24 +0100 Subject: [PATCH] fixup! mingw: remove obsolete IPv6-related code We still need to ensure that sockets are initialized when calling `getaddrinfo()`, otherwise git:// URLs cannot be accessed. This fixes https://github.com/git-for-windows/git/issues/1949. Signed-off-by: Johannes Schindelin --- compat/mingw.c | 8 ++++++++ compat/mingw.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/compat/mingw.c b/compat/mingw.c index 591eccc638..ce8bdfe67b 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2143,6 +2143,14 @@ struct hostent *mingw_gethostbyname(const char *host) return gethostbyname(host); } +#undef getaddrinfo +int mingw_getaddrinfo(const char *node, const char *service, + const struct addrinfo *hints, struct addrinfo **res) +{ + ensure_socket_initialization(); + return getaddrinfo(node, service, hints, res); +} + int mingw_socket(int domain, int type, int protocol) { int sockfd; diff --git a/compat/mingw.h b/compat/mingw.h index ffa6831388..b75c03a2e8 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -297,6 +297,10 @@ int mingw_gethostname(char *host, int namelen); struct hostent *mingw_gethostbyname(const char *host); #define gethostbyname mingw_gethostbyname +int mingw_getaddrinfo(const char *node, const char *service, + const struct addrinfo *hints, struct addrinfo **res); +#define getaddrinfo mingw_getaddrinfo + int mingw_socket(int domain, int type, int protocol); #define socket mingw_socket