[glib/glib-2-22] Don't call WSAEventSelect() on -1



commit 1f604fe208edb3c4caa8c79e8157d57f5587fdee
Author: Tor Lillqvist <tml iki fi>
Date:   Wed Nov 4 23:59:18 2009 +0200

    Don't call WSAEventSelect() on -1
    
    If g_io_win32_sock_close() has been called on a socket channel, don't
    later in g_io_win32_free() call WSAEventSelect() on its fd which has
    been set to -1.

 glib/giowin32.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/glib/giowin32.c b/glib/giowin32.c
index d638544..d661865 100644
--- a/glib/giowin32.c
+++ b/glib/giowin32.c
@@ -1137,7 +1137,8 @@ g_io_win32_free (GIOChannel *channel)
 	  g_free (emsg);
 	}
 
-  if (win32_channel->type == G_IO_WIN32_SOCKET)
+  if (win32_channel->type == G_IO_WIN32_SOCKET &&
+      win32_channel->fd != -1)
     if (WSAEventSelect (win32_channel->fd, NULL, 0) == SOCKET_ERROR)
       if (win32_channel->debug)
 	{



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