diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-02-21 16:47:51 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-03-13 15:23:37 +0400 |
commit | f5fd677ae7cf7cfb07b12adbfd479c460ddc3ac5 (patch) | |
tree | 20c527712fd1611992b572d4362a41011392349c /io | |
parent | 3ffef1a55ca3b55fa64d43cd35af5adb2c260463 (diff) | |
download | qemu-f5fd677ae7cf7cfb07b12adbfd479c460ddc3ac5.zip qemu-f5fd677ae7cf7cfb07b12adbfd479c460ddc3ac5.tar.gz qemu-f5fd677ae7cf7cfb07b12adbfd479c460ddc3ac5.tar.bz2 |
win32/socket: introduce qemu_socket_select() helper
This is a wrapper for WSAEventSelect, with Error handling. By default,
it will produce a warning, so callers don't have to be modified
now, and yet we can spot potential mis-use.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Message-Id: <20230221124802.4103554-7-marcandre.lureau@redhat.com>
Diffstat (limited to 'io')
-rw-r--r-- | io/channel-socket.c | 4 | ||||
-rw-r--r-- | io/channel-watch.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/io/channel-socket.c b/io/channel-socket.c index 2040297..0bc29c4 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -442,7 +442,7 @@ static void qio_channel_socket_finalize(Object *obj) } } #ifdef WIN32 - WSAEventSelect(ioc->fd, NULL, 0); + qemu_socket_select(ioc->fd, NULL, 0, NULL); #endif closesocket(ioc->fd); ioc->fd = -1; @@ -846,7 +846,7 @@ qio_channel_socket_close(QIOChannel *ioc, if (sioc->fd != -1) { #ifdef WIN32 - WSAEventSelect(sioc->fd, NULL, 0); + qemu_socket_select(sioc->fd, NULL, 0, NULL); #endif if (qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_LISTEN)) { socket_listen_cleanup(sioc->fd, errp); diff --git a/io/channel-watch.c b/io/channel-watch.c index ad7c568..6ac4100 100644 --- a/io/channel-watch.c +++ b/io/channel-watch.c @@ -281,9 +281,9 @@ GSource *qio_channel_create_socket_watch(QIOChannel *ioc, GSource *source; QIOChannelSocketSource *ssource; - WSAEventSelect(socket, ioc->event, - FD_READ | FD_ACCEPT | FD_CLOSE | - FD_CONNECT | FD_WRITE | FD_OOB); + qemu_socket_select(socket, ioc->event, + FD_READ | FD_ACCEPT | FD_CLOSE | + FD_CONNECT | FD_WRITE | FD_OOB, NULL); source = g_source_new(&qio_channel_socket_source_funcs, sizeof(QIOChannelSocketSource)); |