Fix trustlist.txt Problem gpg4win-compendium-de-3.0.0-beta2@1264
authorWerner Koch <wk@gnupg.org>
Mon, 22 Jun 2009 11:33:33 +0000 (11:33 +0000)
committerWerner Koch <wk@gnupg.org>
Mon, 22 Jun 2009 11:33:33 +0000 (11:33 +0000)
ChangeLog
Makefile.am
patches/gnupg2-2.0.12/02-pth-estream.patch [new file with mode: 0755]

index 3fd0943..3e33837 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-22  Werner Koch  <wk@g10code.com>
+
+       * patches/gnupg2-2.0.12/02-pth-estream.patch: New.
+       * Makefile.am (EXTRA_DIST): Add it.
+
 2009-06-21  Marcus Brinkmann  <marcus@g10code.de>
 
        * patches/gpgme-1.2.0/01-w32-io-threads.patch: New file.
index cbc2600..928e751 100644 (file)
@@ -44,6 +44,7 @@ EXTRA_DIST = autogen.sh README.SVN \
        patches/gnupg2-2.0.9/04-ks-w32init.patch \
        patches/gnupg2-2.0.9/05-w32-http.patch \
        patches/gnupg2-2.0.12/01-scd-pw2.patch \
+       patches/gnupg2-2.0.12/02-pth-estream.patch \
        patches/gpgol-0.9.91/01-gpgme.patch \
        patches/claws-mail-3.7.1/01-fix-spaces-after-re.patch \
        patches/claws-mail-3.7.1/02-3.7.1cvs22.patch \
diff --git a/patches/gnupg2-2.0.12/02-pth-estream.patch b/patches/gnupg2-2.0.12/02-pth-estream.patch
new file mode 100755 (executable)
index 0000000..e887363
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+patch -p0 -f $* < $0
+exit $?
+
+2009-06-22  Werner Koch  <wk@g10code.com>
+
+       * estream.c (es_pth_read, es_pth_write) [W32]: New.
+       (ESTREAM_SYS_READ, ESTREAM_SYS_WRITE) [HAVE_PTH]: Use them.
+
+
+Index: common/estream.c
+===================================================================
+--- common/estream.c   (revision 5047)
++++ common/estream.c   (working copy)
+@@ -138,8 +138,8 @@
+ /* Primitive system I/O.  */
+ #ifdef HAVE_PTH
+-# define ESTREAM_SYS_READ  pth_read
+-# define ESTREAM_SYS_WRITE pth_write
++# define ESTREAM_SYS_READ  es_pth_read
++# define ESTREAM_SYS_WRITE es_pth_write
+ #else
+ # define ESTREAM_SYS_READ  read
+ # define ESTREAM_SYS_WRITE write
+@@ -325,8 +325,47 @@
+   return ret;
+ }
++
\f
++/*
++ * I/O Helper
++ *
++ * Unfortunately our Pth emulation for Windows expects system handles
++ * for pth_read and pth_write.  We use a simple approach to fix this:
++ * If the function returns an error we fall back to a vanilla read or
++ * write, assuming that we do I/O on a plain file where the operation
++ * can't block.
++ */
++#ifdef HAVE_PTH
++static int
++es_pth_read (int fd, void *buffer, size_t size)
++{
++# ifdef HAVE_W32_SYSTEM
++  int rc = pth_read (fd, buffer, size);
++  if (rc == -1 && errno == EINVAL)
++    rc = read (fd, buffer, size);
++  return rc;
++# else /*!HAVE_W32_SYSTEM*/
++  return pth_read (fd, buffer, size);
++# endif /* !HAVE_W32_SYSTEM*/
++}
++static int
++es_pth_write (int fd, const void *buffer, size_t size)
++{
++# ifdef HAVE_W32_SYSTEM
++  int rc = pth_write (fd, buffer, size);
++  if (rc == -1 && errno == EINVAL)
++    rc = write (fd, buffer, size);
++  return rc;
++# else /*!HAVE_W32_SYSTEM*/
++  return pth_write (fd, buffer, size);
++# endif /* !HAVE_W32_SYSTEM*/
++}
++#endif /*HAVE_PTH*/
++
++\f
++
+ /*
+  * Initialization.
+  */