[svn] dirmngr - r298 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Tue Mar 25 04:47:42 CET 2008
Author: marcus
Date: 2008-03-25 04:47:41 +0100 (Tue, 25 Mar 2008)
New Revision: 298
Modified:
trunk/src/ChangeLog
trunk/src/dirmngr_ldap.c
Log:
2008-03-25 Marcus Brinkmann <marcus at g10code.de>
* dirmngr_ldap.c (print_ldap_entries): Add code alternative for
W32 console stdout (unused at this point).
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2008-03-21 04:32:37 UTC (rev 297)
+++ trunk/src/ChangeLog 2008-03-25 03:47:41 UTC (rev 298)
@@ -1,3 +1,8 @@
+2008-03-25 Marcus Brinkmann <marcus at g10code.de>
+
+ * dirmngr_ldap.c (print_ldap_entries): Add code alternative for
+ W32 console stdout (unused at this point).
+
2008-03-21 Marcus Brinkmann <marcus at g10code.de>
* estream.c (ESTREAM_MUTEX_DESTROY): New macro.
Modified: trunk/src/dirmngr_ldap.c
===================================================================
--- trunk/src/dirmngr_ldap.c 2008-03-21 04:32:37 UTC (rev 297)
+++ trunk/src/dirmngr_ldap.c 2008-03-25 03:47:41 UTC (rev 298)
@@ -435,8 +435,12 @@
return -1;
}
}
- if (fwrite (values[0]->bv_val, values[0]->bv_len,
- 1, stdout) != 1)
+#if 1
+ /* Note: this does not work for STDOUT on a Windows
+ console, where it fails with "Not enough space" for
+ CRLs which are 52 KB or larger. */
+ if (fwrite (values[0]->bv_val, values[0]->bv_len,
+ 1, stdout) != 1)
{
log_error (_("error writing to stdout: %s\n"),
strerror (errno));
@@ -445,6 +449,33 @@
ber_free (berctx, 0);
return -1;
}
+#else
+ /* On Windows console STDOUT, we have to break up the
+ writes into small parts. */
+ {
+ int n = 0;
+ while (n < values[0]->bv_len)
+ {
+ int cnt = values[0]->bv_len - n;
+ /* The actual limit is (52 * 1024 - 1) on Windows XP SP2. */
+#define MAX_CNT (32*1024)
+ if (cnt > MAX_CNT)
+ cnt = MAX_CNT;
+
+ if (fwrite (((char *) values[0]->bv_val) + n, cnt, 1,
+ stdout) != 1)
+ {
+ log_error (_("error writing to stdout: %s\n"),
+ strerror (errno));
+ ldap_value_free_len (values);
+ ldap_memfree (attr);
+ ber_free (berctx, 0);
+ return -1;
+ }
+ n += cnt;
+ }
+ }
+#endif
any = 1;
if (!opt.multi)
break; /* Print only the first value. */
More information about the Gnupg-commits
mailing list