mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
gresolver: Don’t use gai_strerror() on Windows, as it isn’t threadsafe
Instead, use WSAGetLastError(). Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1732
This commit is contained in:
@@ -340,9 +340,19 @@ handle_ip_address (const char *hostname,
|
||||
if (inet_aton (hostname, &ip4addr))
|
||||
#endif
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
gchar *error_message = g_win32_error_message (WSAHOST_NOT_FOUND);
|
||||
#else
|
||||
const gchar *error_message = gai_strerror (EAI_NONAME);
|
||||
#endif
|
||||
g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
|
||||
_("Error resolving “%s”: %s"),
|
||||
hostname, gai_strerror (EAI_NONAME));
|
||||
hostname, error_message);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
g_free (error_message);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user