提交 37e3daf4 编写于 作者: K Kurt Roeckx

Make fallback addresses static so that we can initialize it

Reviewed-by: NRichard Levitte <levitte@openssl.org>

MR: #1841
上级 47c1a0e0
...@@ -672,18 +672,20 @@ int BIO_lookup(const char *host, const char *service, ...@@ -672,18 +672,20 @@ int BIO_lookup(const char *host, const char *service,
} }
} else { } else {
#endif #endif
struct hostent *he; const struct hostent *he;
/* Windows doesn't seem to have in_addr_t */ /* Windows doesn't seem to have in_addr_t */
#ifdef OPENSSL_SYS_WINDOWS #ifdef OPENSSL_SYS_WINDOWS
uint32_t he_fallback_address = INADDR_ANY; static uint32_t he_fallback_address;
uint32_t *he_fallback_addresses[] = { &he_fallback_address, NULL }; static const uint32_t *he_fallback_addresses[] =
{ &he_fallback_address, NULL };
#else #else
in_addr_t he_fallback_address = INADDR_ANY; static in_addr_t he_fallback_address;
in_addr_t *he_fallback_addresses[] = { &he_fallback_address, NULL }; static const in_addr_t *he_fallback_addresses[] =
{ &he_fallback_address, NULL };
#endif #endif
struct hostent he_fallback = { NULL, NULL, AF_INET, static const struct hostent he_fallback =
sizeof(he_fallback_address), { NULL, NULL, AF_INET, sizeof(he_fallback_address),
(char **)&he_fallback_addresses }; (char **)&he_fallback_addresses };
struct servent *se; struct servent *se;
/* Apprently, on WIN64, s_proto and s_port have traded places... */ /* Apprently, on WIN64, s_proto and s_port have traded places... */
#ifdef _WIN64 #ifdef _WIN64
...@@ -695,6 +697,7 @@ int BIO_lookup(const char *host, const char *service, ...@@ -695,6 +697,7 @@ int BIO_lookup(const char *host, const char *service,
CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME);
CRYPTO_w_lock(CRYPTO_LOCK_GETSERVBYNAME); CRYPTO_w_lock(CRYPTO_LOCK_GETSERVBYNAME);
he_fallback_address = INADDR_ANY;
if (host == NULL) { if (host == NULL) {
he = &he_fallback; he = &he_fallback;
switch(lookup_type) { switch(lookup_type) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册