From 1f5d7eeaa7ed8b3016f9dc946b6e530e4fcef0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Mon, 11 Feb 2019 23:43:14 +0000 Subject: [PATCH] socket test: Adjust for Windows-specific sendto() error With winsock sending messages to NULL results in G_IO_ERROR_NOT_CONNECTED instead of G_IO_ERROR_FAILED. MSDN says: WSAENOTCONN 10057 Socket is not connected. A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto) no address was supplied. So this is a direct mapping of the implementation error. Covering it up in the wrapper (by converting it to G_IO_ERROR_FAILED) doesn't seem feasible or needed (no one, except for the testsuite, really cares which unrecoverable error is returned by sendto()). --- gio/tests/socket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gio/tests/socket.c b/gio/tests/socket.c index 8410a3e84..064202d11 100644 --- a/gio/tests/socket.c +++ b/gio/tests/socket.c @@ -757,7 +757,12 @@ test_ip_sync_dgram (GSocketFamily family) m[1].address = NULL; m[2].address = NULL; len = g_socket_send_messages (client, m, G_N_ELEMENTS (m), 0, NULL, &error); + /* This error code may vary between platforms and over time; it is not guaranteed API: */ +#ifndef G_OS_WIN32 g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED); +#else + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_CONNECTED); +#endif g_clear_error (&error); g_assert_cmpint (len, ==, -1);