From 25657fc6c1b693096e2ceadaa53cd10c1e81c8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 21 Feb 2023 16:48:01 +0400 Subject: win32: replace closesocket() with close() wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a close() wrapper instead, so that we don't need to worry about closesocket() vs close() anymore, let's hope. Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Berger Message-Id: <20230221124802.4103554-17-marcandre.lureau@redhat.com> --- io/channel-socket.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'io') diff --git a/io/channel-socket.c b/io/channel-socket.c index 03757c7..b0ea7d4 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -159,7 +159,7 @@ int qio_channel_socket_connect_sync(QIOChannelSocket *ioc, trace_qio_channel_socket_connect_complete(ioc, fd); if (qio_channel_socket_set_fd(ioc, fd, errp) < 0) { - closesocket(fd); + close(fd); return -1; } @@ -233,7 +233,7 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, trace_qio_channel_socket_listen_complete(ioc, fd); if (qio_channel_socket_set_fd(ioc, fd, errp) < 0) { - closesocket(fd); + close(fd); return -1; } qio_channel_set_feature(QIO_CHANNEL(ioc), QIO_CHANNEL_FEATURE_LISTEN); @@ -310,7 +310,7 @@ int qio_channel_socket_dgram_sync(QIOChannelSocket *ioc, trace_qio_channel_socket_dgram_complete(ioc, fd); if (qio_channel_socket_set_fd(ioc, fd, errp) < 0) { - closesocket(fd); + close(fd); return -1; } @@ -444,7 +444,7 @@ static void qio_channel_socket_finalize(Object *obj) #ifdef WIN32 qemu_socket_unselect(ioc->fd, NULL); #endif - closesocket(ioc->fd); + close(ioc->fd); ioc->fd = -1; } } @@ -852,7 +852,7 @@ qio_channel_socket_close(QIOChannel *ioc, socket_listen_cleanup(sioc->fd, errp); } - if (closesocket(sioc->fd) < 0) { + if (close(sioc->fd) < 0) { sioc->fd = -1; error_setg_errno(&err, errno, "Unable to close socket"); error_propagate(errp, err); -- cgit v1.1