[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/30] util: WSAEWOULDBLOCK on connect should map to EINPROGRESS
From: |
Paolo Bonzini |
Subject: |
[PULL 26/30] util: WSAEWOULDBLOCK on connect should map to EINPROGRESS |
Date: |
Wed, 2 Oct 2019 18:51:49 +0200 |
From: Marc-André Lureau <address@hidden>
In general, WSAEWOULDBLOCK can be mapped to EAGAIN as done by
socket_error() (or EWOULDBLOCK). But for connect() with non-blocking
sockets, it actually means the operation is in progress:
https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect
"The socket is marked as nonblocking and the connection cannot be completed
immediately."
(this is also the behaviour implemented by GLib GSocket)
This fixes socket_can_bind_connect() test on win32.
Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
util/oslib-win32.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index c62cd43..886e400 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -585,7 +585,11 @@ int qemu_connect_wrap(int sockfd, const struct sockaddr
*addr,
int ret;
ret = connect(sockfd, addr, addrlen);
if (ret < 0) {
- errno = socket_error();
+ if (WSAGetLastError() == WSAEWOULDBLOCK) {
+ errno = EINPROGRESS;
+ } else {
+ errno = socket_error();
+ }
}
return ret;
}
--
1.8.3.1
- [PULL 15/30] microblaze: fix leak of fdevice tree blob, (continued)
- [PULL 15/30] microblaze: fix leak of fdevice tree blob, Paolo Bonzini, 2019/10/02
- [PULL 17/30] hppa: fix leak from g_strdup_printf, Paolo Bonzini, 2019/10/02
- [PULL 18/30] mips: fix memory leaks in board initialization, Paolo Bonzini, 2019/10/02
- [PULL 20/30] lm32: do not leak memory on object_new/object_unref, Paolo Bonzini, 2019/10/02
- [PULL 21/30] docker: test-debug: disable LeakSanitizer, Paolo Bonzini, 2019/10/02
- [PULL 19/30] cris: do not leak struct cris_disasm_data, Paolo Bonzini, 2019/10/02
- [PULL 22/30] i386: Add CPUID bit for CLZERO and XSAVEERPTR, Paolo Bonzini, 2019/10/02
- [PULL 23/30] vfio: Turn the container error into an Error handle, Paolo Bonzini, 2019/10/02
- [PULL 25/30] Fix wrong behavior of cpu_memory_rw_debug() function in SMM, Paolo Bonzini, 2019/10/02
- [PULL 26/30] util: WSAEWOULDBLOCK on connect should map to EINPROGRESS,
Paolo Bonzini <=
- [PULL 24/30] memory: allow memory_region_register_iommu_notifier() to fail, Paolo Bonzini, 2019/10/02
- [PULL 28/30] win32: work around main-loop busy loop on socket/fd event, Paolo Bonzini, 2019/10/02
- [PULL 29/30] tests/docker: only enable ubsan for test-clang, Paolo Bonzini, 2019/10/02
- [PULL 30/30] accel/kvm: ensure ret always set, Paolo Bonzini, 2019/10/02
- [PULL 27/30] tests: skip serial test on windows, Paolo Bonzini, 2019/10/02
- Re: [PULL 00/30] Misc patches for 2010-10-02, no-reply, 2019/10/02
- [PULL 00/30] Misc patches for 2010-10-02, Paolo Bonzini, 2019/10/03