abe34282b0
Until now, a win32 SOCKET handle is often cast to an int file descriptor, as this is what other OS use for sockets. When necessary, QEMU eventually queries whether it's a socket with the help of fd_is_socket(). However, there is no guarantee of conflict between the fd and SOCKET space. Such conflict would have surprising consequences, we shouldn't mix them. Also, it is often forgotten that SOCKET must be closed with closesocket(), and not close(). Instead, let's make the win32 socket wrapper functions return and take a file descriptor, and let util/ wrappers do the fd/SOCKET conversion as necessary. A bit of adaptation is necessary in io/ as well. Unfortunately, we can't drop closesocket() usage, despite _open_osfhandle() documentation claiming transfer of ownership, testing shows bad behaviour if you forget to call closesocket(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-15-marcandre.lureau@redhat.com> |
||
---|---|---|
.. | ||
channel-buffer.c | ||
channel-command.c | ||
channel-file.c | ||
channel-null.c | ||
channel-socket.c | ||
channel-tls.c | ||
channel-util.c | ||
channel-watch.c | ||
channel-websock.c | ||
channel.c | ||
dns-resolver.c | ||
meson.build | ||
net-listener.c | ||
task.c | ||
trace-events | ||
trace.h |