[svn] GnuPG - r5053 - trunk/common
svn author wk
cvs at cvs.gnupg.org
Mon Jun 29 10:54:19 CEST 2009
Author: wk
Date: 2009-06-29 10:54:18 +0200 (Mon, 29 Jun 2009)
New Revision: 5053
Modified:
trunk/common/ChangeLog
trunk/common/estream.c
Log:
The variable is called RET and not RC.
Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog 2009-06-25 14:10:14 UTC (rev 5052)
+++ trunk/common/ChangeLog 2009-06-29 08:54:18 UTC (rev 5053)
@@ -1,3 +1,7 @@
+2009-06-29 Werner Koch <wk at g10code.com>
+
+ * estream.c (es_write_sanitized_utf8_buffer): Typo typo fix.
+
2009-06-25 Werner Koch <wk at g10code.com>
* estream.c (es_write_sanitized_utf8_buffer): Typo fix.
@@ -12,6 +16,11 @@
* sexputil.c (get_rsa_pk_from_canon_sexp): Check for error after
the loop. Reported by Fabian Keil.
+2009-06-22 Werner Koch <wk at g10code.com>
+
+ * estream.c (es_pth_read, es_pth_write) [W32]: New.
+ (ESTREAM_SYS_READ, ESTREAM_SYS_WRITE) [HAVE_PTH]: Use them.
+
2009-06-03 Werner Koch <wk at g10code.com>
* estream.c (es_convert_mode): Rewrite and support the "x" flag.
Modified: trunk/common/estream.c
===================================================================
--- trunk/common/estream.c 2009-06-25 14:10:14 UTC (rev 5052)
+++ trunk/common/estream.c 2009-06-29 08:54:18 UTC (rev 5053)
@@ -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
@@ -231,7 +231,7 @@
while (0)
-/* Malloc wrappers to overcvome problems on some older OSes. */
+/* Malloc wrappers to overcome problems on some older OSes. */
static void *
mem_alloc (size_t n)
{
@@ -325,8 +325,47 @@
return ret;
}
+
+/*
+ * 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*/
+
+
+
/*
* Initialization.
*/
@@ -3205,7 +3244,7 @@
*bytes_written = strlen (buf);
ret = es_fputs (buf, stream);
xfree (buf);
- return rc == EOF? ret : (int)i;
+ return ret == EOF? ret : (int)i;
}
else
return es_write_sanitized (stream, p, length, delimiters, bytes_written);
More information about the Gnupg-commits
mailing list