aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2010-08-02 18:54:53 +0000
committerWerner Koch <[email protected]>2010-08-02 18:54:53 +0000
commit819f3be3585e125328025113780e2f326cc7a3e9 (patch)
treec40e2f8c427aa29b78fbef0c44188986fb668ba6 /common
parentFixed couple of build problems. However the W32 version is currently (diff)
downloadgnupg-819f3be3585e125328025113780e2f326cc7a3e9.tar.gz
gnupg-819f3be3585e125328025113780e2f326cc7a3e9.zip
Add code for a threaded LDAP access to replace the wrapper process.
Currently used for W32 and W32CE.
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog4
-rw-r--r--common/estream.c23
2 files changed, 26 insertions, 1 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index a60cf1ea8..05611f9c8 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-26 Werner Koch <[email protected]>
+
+ * estream.c (es_func_fp_write) [W32]: Write smaller chunks.
+
2010-07-25 Werner Koch <[email protected]>
* argparse.c (initialize): Use ARGPARSE_PRINT_WARNING constant.
diff --git a/common/estream.c b/common/estream.c
index ec7c7099b..f3ba109ee 100644
--- a/common/estream.c
+++ b/common/estream.c
@@ -955,7 +955,28 @@ es_func_fp_write (void *cookie, const void *buffer, size_t size)
if (file_cookie->fp)
- bytes_written = fwrite (buffer, 1, size, file_cookie->fp);
+ {
+#ifdef HAVE_W32_SYSTEM
+ /* Using an fwrite to stdout connected to the console fails with
+ the error "Not enough space" for an fwrite size of >= 52KB
+ (tested on Windows XP SP2). To solve this we always chunk
+ the writes up into smaller blocks. */
+ bytes_written = 0;
+ while (bytes_written < size)
+ {
+ size_t cnt = size - bytes_written;
+
+ if (cnt > 32*1024)
+ cnt = 32*1024;
+ if (fwrite ((const char*)buffer + bytes_written,
+ cnt, 1, file_cookie->fp) != 1)
+ break; /* Write error. */
+ bytes_written += cnt;
+ }
+#else
+ bytes_written = fwrite (buffer, 1, size, file_cookie->fp);
+#endif
+ }
else
bytes_written = size; /* Successfully written to the bit bucket. */
if (bytes_written != size)