mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-02 17:26:17 +01:00
gio/tests: fix socket /socket/credentials/unix_socketpair on win32
When I enabled unix socketpair test on win32, I left the existing g_close(fds[1]), but _g_win32_socketpair() returns native sockets descriptors that must be closed with closesocket() on win32. Let GSocket handle the socket pair cleanup. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
89539d9ae0
commit
e9f46d3529
@ -2243,7 +2243,7 @@ test_credentials_unix_socketpair (void)
|
|||||||
{
|
{
|
||||||
gint fds[2];
|
gint fds[2];
|
||||||
gint status;
|
gint status;
|
||||||
GSocket *sock;
|
GSocket *sock[2];
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GCredentials *creds;
|
GCredentials *creds;
|
||||||
|
|
||||||
@ -2259,9 +2259,12 @@ test_credentials_unix_socketpair (void)
|
|||||||
#endif
|
#endif
|
||||||
g_assert_cmpint (status, ==, 0);
|
g_assert_cmpint (status, ==, 0);
|
||||||
|
|
||||||
sock = g_socket_new_from_fd (fds[0], &error);
|
sock[0] = g_socket_new_from_fd (fds[0], &error);
|
||||||
|
g_assert_no_error (error);
|
||||||
|
sock[1] = g_socket_new_from_fd (fds[1], &error);
|
||||||
|
g_assert_no_error (error);
|
||||||
|
|
||||||
creds = g_socket_get_credentials (sock, &error);
|
creds = g_socket_get_credentials (sock[0], &error);
|
||||||
if (creds != NULL)
|
if (creds != NULL)
|
||||||
{
|
{
|
||||||
gchar *str = g_credentials_to_string (creds);
|
gchar *str = g_credentials_to_string (creds);
|
||||||
@ -2276,8 +2279,8 @@ test_credentials_unix_socketpair (void)
|
|||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (sock);
|
g_object_unref (sock[0]);
|
||||||
g_close (fds[1], NULL);
|
g_object_unref (sock[1]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user