[glib: 7/12] gio: return G_IO_NVAL if the socket is already closed




commit 2f8a9196b8b47036b99058a6828892eeaa55b57b
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Wed Jan 19 15:58:40 2022 +0400

    gio: return G_IO_NVAL if the socket is already closed
    
    For consistency with Unix behaviour, as checked in the tests/socket.c.
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 gio/gsocket.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index d15a18101..4e69d2797 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -3997,7 +3997,10 @@ socket_source_dispatch (GSource     *source,
   gboolean ret;
 
 #ifdef G_OS_WIN32
-  events = update_condition (socket_source->socket);
+  if ((socket_source->pollfd.revents & G_IO_NVAL) != 0)
+    events = G_IO_NVAL;
+  else
+    events = update_condition (socket_source->socket);
 #else
   if (g_socket_is_closed (socket_source->socket))
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]