diff options
| author | Werner Koch <[email protected]> | 2010-08-02 18:54:53 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2010-08-02 18:54:53 +0000 |
| commit | 819f3be3585e125328025113780e2f326cc7a3e9 (patch) | |
| tree | c40e2f8c427aa29b78fbef0c44188986fb668ba6 /common/estream.c | |
| parent | Fixed couple of build problems. However the W32 version is currently (diff) | |
| download | gnupg-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/estream.c')
| -rw-r--r-- | common/estream.c | 23 |
1 files changed, 22 insertions, 1 deletions
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) |
