mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16: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 status;
|
||||
GSocket *sock;
|
||||
GSocket *sock[2];
|
||||
GError *error = NULL;
|
||||
GCredentials *creds;
|
||||
|
||||
@ -2259,9 +2259,12 @@ test_credentials_unix_socketpair (void)
|
||||
#endif
|
||||
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)
|
||||
{
|
||||
gchar *str = g_credentials_to_string (creds);
|
||||
@ -2276,8 +2279,8 @@ test_credentials_unix_socketpair (void)
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
g_object_unref (sock);
|
||||
g_close (fds[1], NULL);
|
||||
g_object_unref (sock[0]);
|
||||
g_object_unref (sock[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user