[glib: 1/4] socket test: Adjust for Windows-specific sendto() error
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/4] socket test: Adjust for Windows-specific sendto() error
- Date: Mon, 18 Feb 2019 12:55:08 +0000 (UTC)
commit 1f5d7eeaa7ed8b3016f9dc946b6e530e4fcef0fe
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Mon Feb 11 23:43:14 2019 +0000
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]