2009-04-08 Marcus Brinkmann <marcus@g10code.de>
authorMarcus Brinkmann <mb@g10code.com>
Wed, 8 Apr 2009 18:00:36 +0000 (18:00 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Wed, 8 Apr 2009 18:00:36 +0000 (18:00 +0000)
* Makefile.am (EXTRA_DIST): Remove glib-2.9.2 patches and add
patches/glib-2.20.0/01-socket.patch.
* patches/glib-2.12.12/01-socket.patch: New file.
* patches/glib-2.9.2-wk1/01-giowin32.patch,
patches/glib-2.9.2-wk1/02-gspawn-w32.patch,
patches/glib-2.9.2-wk1/03-gspawn-w32-fixup.patch,
patches/glib-2.9.2-wk1/04-gspawn-w32-buffering.patch: Removed.

ChangeLog
Makefile.am
patches/glib-2.20.0/01-socket.patch [new file with mode: 0755]

index aac17c5..dbcd32a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-04-08  Marcus Brinkmann  <marcus@g10code.de>
+
+       * Makefile.am (EXTRA_DIST): Remove glib-2.9.2 patches and add
+       patches/glib-2.20.0/01-socket.patch.
+       * patches/glib-2.12.12/01-socket.patch: New file.
+       * patches/glib-2.9.2-wk1/01-giowin32.patch,
+       patches/glib-2.9.2-wk1/02-gspawn-w32.patch,
+       patches/glib-2.9.2-wk1/03-gspawn-w32-fixup.patch,
+       patches/glib-2.9.2-wk1/04-gspawn-w32-buffering.patch: Removed.
+
 2009-04-03  Marcus Brinkmann  <marcus@g10code.de>
 
        * packages/packages.current: Update pinentry, libpng, glib, atk,
index 15b8bc1..3022ca9 100644 (file)
@@ -24,13 +24,10 @@ SUBDIRS = po packages include doc src
 
 EXTRA_DIST = autogen.sh README.SVN \
         patches/pthreads-w32-2-7-0-release/01-make.patch \
-        patches/glib-2.9.2-wk1/01-giowin32.patch \
-        patches/glib-2.9.2-wk1/02-gspawn-w32.patch \
-        patches/glib-2.9.2-wk1/03-gspawn-w32-fixup.patch \
-        patches/glib-2.9.2-wk1/04-gspawn-w32-buffering.patch \
         patches/glib-2.12.12/01-giowin32.patch \
         patches/glib-2.12.12/02-gspawn-w32.patch \
         patches/glib-2.12.12/03-gspawn-w32-fixup.patch \
+        patches/glib-2.20.0/01-socket.patch \
        patches/gpgme/01-gpg2.patch \
        patches/gpgme-1.1.7/01-registry.patch \
        patches/gpgme-1.1.7/02-extern-umlaute.patch \
diff --git a/patches/glib-2.20.0/01-socket.patch b/patches/glib-2.20.0/01-socket.patch
new file mode 100755 (executable)
index 0000000..06ea890
--- /dev/null
@@ -0,0 +1,92 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+Fix a couple of buglets in the I/O channel implementation.
+
+diff -rup glib-2.20.0-orig/glib/giowin32.c glib-2.20.0/glib/giowin32.c
+--- glib-2.20.0-orig/glib/giowin32.c   2009-03-13 05:09:59.000000000 +0100
++++ glib-2.20.0/glib/giowin32.c        2009-04-08 15:24:59.000000000 +0200
+@@ -285,7 +285,7 @@ g_io_channel_win32_init (GIOWin32Channel
+   channel->event_mask = 0;
+   channel->last_events = 0;
+-  channel->event = NULL;
++  channel->event = WSA_INVALID_EVENT;
+   channel->write_would_have_blocked = FALSE;
+   channel->ever_writable = FALSE;
+ }
+@@ -1144,7 +1144,7 @@ g_io_win32_free (GIOChannel *channel)
+         g_free (emsg);
+       }
+-  if (win32_channel->event)
++  if (win32_channel->event != WSA_INVALID_EVENT)
+     if (!WSACloseEvent (win32_channel->event))
+       if (win32_channel->debug)
+       {
+@@ -1595,7 +1595,7 @@ g_io_win32_sock_create_watch (GIOChannel
+   
+   watch->condition = condition;
+-  if (win32_channel->event == 0)
++  if (win32_channel->event == WSA_INVALID_EVENT)
+     win32_channel->event = WSACreateEvent ();
+   watch->pollfd.fd = (gintptr) win32_channel->event;
+@@ -2161,7 +2161,54 @@ g_io_channel_win32_make_pollfd (GIOChann
+       break;
+     case G_IO_WIN32_SOCKET:
+-      fd->fd = (gintptr) WSACreateEvent ();
++      if (win32_channel->event == WSA_INVALID_EVENT)
++      win32_channel->event = WSACreateEvent ();
++      fd->fd = (gintptr) win32_channel->event;
++
++      if (fd->fd == (gintptr) WSA_INVALID_EVENT)
++      {
++        gchar *emsg = g_win32_error_message (GetLastError ());
++        
++        g_error ("Error creating event: %s", emsg);
++        g_free (emsg);
++      }
++      else
++      {
++        int event_mask = 0;
++
++        if (condition & G_IO_IN)
++          event_mask |= (FD_READ | FD_ACCEPT);
++        if (condition & G_IO_OUT)
++          event_mask |= (FD_WRITE | FD_CONNECT);
++        event_mask |= FD_CLOSE;
++
++        ResetEvent ((WSAEVENT) fd->fd);
++
++        if (win32_channel->debug)
++          g_print ("WSAEventSelect(%d,%p,{%s})",
++                   win32_channel->fd, (HANDLE) fd->fd,
++                   event_mask_to_string (event_mask));
++        if (WSAEventSelect (win32_channel->fd, (HANDLE) fd->fd,
++                            event_mask) == SOCKET_ERROR)
++          if (win32_channel->debug)
++            {
++              gchar *emsg = g_win32_error_message (WSAGetLastError ());
++
++              g_print (" failed: %s", emsg);
++              g_free (emsg);
++            }
++        if (win32_channel->debug)
++          g_print ("\n");
++
++        if ((event_mask & FD_WRITE) &&
++            win32_channel->ever_writable &&
++            !win32_channel->write_would_have_blocked)
++          {
++            if (win32_channel->debug)
++              g_print ("WSASetEvent(%p)\n", (WSAEVENT) fd->fd);
++            WSASetEvent ((WSAEVENT) fd->fd);
++          }
++      }
+       break;
+       
+     case G_IO_WIN32_WINDOWS_MESSAGES: