[PATCH 2/4] io: use closesocket()

marcandre.lureau@redhat.com posted 4 patches 2 years, 12 months ago
Maintainers: Stefan Berger <stefanb@linux.vnet.ibm.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Stefan Weil <sw@weilnetz.de>, Jason Wang <jasowang@redhat.com>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Joel Stanley <joel@jms.id.au>, Peter Maydell <peter.maydell@linaro.org>
There is a newer version of this series
[PATCH 2/4] io: use closesocket()
Posted by marcandre.lureau@redhat.com 2 years, 12 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Because they are actually sockets...

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 io/channel-socket.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/io/channel-socket.c b/io/channel-socket.c
index 7aca84f61a..2040297d2b 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) {
-        close(fd);
+        closesocket(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) {
-        close(fd);
+        closesocket(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) {
-        close(fd);
+        closesocket(fd);
         return -1;
     }
 
-- 
2.39.1


Re: [PATCH 2/4] io: use closesocket()
Posted by Thomas Huth 2 years, 12 months ago
On 12/02/2023 21.49, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Because they are actually sockets...
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   io/channel-socket.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/io/channel-socket.c b/io/channel-socket.c
> index 7aca84f61a..2040297d2b 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) {
> -        close(fd);
> +        closesocket(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) {
> -        close(fd);
> +        closesocket(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) {
> -        close(fd);
> +        closesocket(fd);
>           return -1;
>       }
>   

Reviewed-by: Thomas Huth <thuth@redhat.com>