win32: replace closesocket() with close() wrapper

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 <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Message-Id: <20230221124802.4103554-17-marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2023-02-21 16:48:01 +04:00
parent b7e5374637
commit 25657fc6c1
14 changed files with 89 additions and 89 deletions

View file

@ -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);