rpcrt4: Avoid gai_strerror().

It's not thread-safe.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-04-27 11:07:22 -05:00 committed by Alexandre Julliard
parent 468ec36c30
commit be101103db
1 changed files with 5 additions and 6 deletions

View File

@ -941,7 +941,7 @@ static size_t rpcrt4_ip_tcp_get_top_of_tower(unsigned char *tower_data,
ret = getaddrinfo("0.0.0.0", endpoint, &hints, &ai); ret = getaddrinfo("0.0.0.0", endpoint, &hints, &ai);
if (ret) if (ret)
{ {
ERR("getaddrinfo failed: %s\n", gai_strerror(ret)); ERR("getaddrinfo failed, error %u\n", WSAGetLastError());
return 0; return 0;
} }
} }
@ -1147,8 +1147,8 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_open(RpcConnection* Connection)
ret = getaddrinfo(Connection->NetworkAddr, Connection->Endpoint, &hints, &ai); ret = getaddrinfo(Connection->NetworkAddr, Connection->Endpoint, &hints, &ai);
if (ret) if (ret)
{ {
ERR("getaddrinfo for %s:%s failed: %s\n", Connection->NetworkAddr, ERR("getaddrinfo for %s:%s failed, error %u\n", Connection->NetworkAddr,
Connection->Endpoint, gai_strerror(ret)); Connection->Endpoint, WSAGetLastError());
return RPC_S_SERVER_UNAVAILABLE; return RPC_S_SERVER_UNAVAILABLE;
} }
@ -1228,8 +1228,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *pr
ret = getaddrinfo(NULL, endpoint ? endpoint : "0", &hints, &ai); ret = getaddrinfo(NULL, endpoint ? endpoint : "0", &hints, &ai);
if (ret) if (ret)
{ {
ERR("getaddrinfo for port %s failed: %s\n", endpoint, ERR("getaddrinfo for port %s failed, error %u\n", endpoint, WSAGetLastError());
gai_strerror(ret));
if ((ret == EAI_SERVICE) || (ret == EAI_NONAME)) if ((ret == EAI_SERVICE) || (ret == EAI_NONAME))
return RPC_S_INVALID_ENDPOINT_FORMAT; return RPC_S_INVALID_ENDPOINT_FORMAT;
return RPC_S_CANT_CREATE_ENDPOINT; return RPC_S_CANT_CREATE_ENDPOINT;
@ -1293,7 +1292,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *pr
NI_NUMERICSERV); NI_NUMERICSERV);
if (ret) if (ret)
{ {
WARN("getnameinfo failed: %s\n", gai_strerror(ret)); WARN("getnameinfo failed, error %u\n", WSAGetLastError());
closesocket(sock); closesocket(sock);
status = RPC_S_CANT_CREATE_ENDPOINT; status = RPC_S_CANT_CREATE_ENDPOINT;
continue; continue;