[svn] GnuPG - r5376 - in trunk: common dirmngr
svn author wk
cvs at cvs.gnupg.org
Sat Jul 24 15:33:04 CEST 2010
Author: wk
Date: 2010-07-24 15:33:03 +0200 (Sat, 24 Jul 2010)
New Revision: 5376
Modified:
trunk/common/ChangeLog
trunk/common/estream.c
trunk/common/estream.h
trunk/dirmngr/ChangeLog
trunk/dirmngr/dirmngr_ldap.c
Log:
Add new set_binary feature to estream
Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog 2010-07-24 09:18:42 UTC (rev 5375)
+++ trunk/common/ChangeLog 2010-07-24 13:33:03 UTC (rev 5376)
@@ -1,3 +1,7 @@
+2010-07-24 Werner Koch <wk at g10code.com>
+
+ * estream.c (es_set_binary): New.
+
2010-07-19 Werner Koch <wk at g10code.com>
* utf8conv.c (utf8_to_wchar): s/malloc/jnlib_malloc/.
Modified: trunk/dirmngr/ChangeLog
===================================================================
--- trunk/dirmngr/ChangeLog 2010-07-24 09:18:42 UTC (rev 5375)
+++ trunk/dirmngr/ChangeLog 2010-07-24 13:33:03 UTC (rev 5376)
@@ -1,3 +1,8 @@
+2010-07-24 Werner Koch <wk at g10code.com>
+
+ * dirmngr_ldap.c (main): Init common subsystems. Call
+ es_set_binary.
+
2010-07-19 Werner Koch <wk at g10code.com>
* dirmngr.c: Include ldap-wrapper.h.
Modified: trunk/common/estream.c
===================================================================
--- trunk/common/estream.c 2010-07-24 09:18:42 UTC (rev 5375)
+++ trunk/common/estream.c 2010-07-24 13:33:03 UTC (rev 5376)
@@ -3399,7 +3399,40 @@
ESTREAM_UNLOCK (stream);
}
+
+/* Put a stream into binary mode. This is only needed for the
+ standard streams if they are to be used in a binary way. On Unix
+ systems it is never needed but MSDOS based systems require such a
+ call. It needs to be called before any I/O is done on STREAM. */
void
+es_set_binary (estream_t stream)
+{
+ ESTREAM_LOCK (stream);
+ if (!(stream->intern->modeflags & O_BINARY))
+ {
+ stream->intern->modeflags |= O_BINARY;
+#ifdef HAVE_DOSISH_SYSTEM
+ if (stream->intern->func_dest.func_read == es_func_fd_read)
+ {
+ estream_cookie_fd_t fd_cookie;
+
+ if (!IS_INVALID_FD (fd_cookie->fd))
+ setmode (fd, O_BINARY);
+ }
+ else if (stream->intern->func_dest.func_read == es_func_fp_read)
+ {
+ estream_cookie_fp_t fp_cookie;
+
+ if (fp_cookie->fd)
+ setmode (fileno (fp_cookie->fp), O_BINARY);
+ }
+#endif
+ }
+ ESTREAM_UNLOCK (stream);
+}
+
+
+void
es_opaque_set (estream_t stream, void *opaque)
{
ESTREAM_LOCK (stream);
Modified: trunk/common/estream.h
===================================================================
--- trunk/common/estream.h 2010-07-24 09:18:42 UTC (rev 5375)
+++ trunk/common/estream.h 2010-07-24 13:33:03 UTC (rev 5376)
@@ -125,6 +125,7 @@
#define es_vfprintf_unlocked _ESTREAM_PREFIX(es_vfprint_unlocked)
#define es_setvbuf _ESTREAM_PREFIX(es_setvbuf)
#define es_setbuf _ESTREAM_PREFIX(es_setbuf)
+#define es_set_binary _ESTREAM_PREFIX(es_set_binary)
#define es_tmpfile _ESTREAM_PREFIX(es_tmpfile)
#define es_opaque_set _ESTREAM_PREFIX(es_opaque_set)
#define es_opaque_get _ESTREAM_PREFIX(es_opaque_get)
@@ -355,6 +356,9 @@
char *ES__RESTRICT buf, int mode, size_t size);
void es_setbuf (estream_t ES__RESTRICT stream, char *ES__RESTRICT buf);
+void es_set_binary (estream_t stream);
+
+
estream_t es_tmpfile (void);
void es_opaque_set (estream_t ES__RESTRICT stream, void *ES__RESTRICT opaque);
Modified: trunk/dirmngr/dirmngr_ldap.c
===================================================================
--- trunk/dirmngr/dirmngr_ldap.c 2010-07-24 09:18:42 UTC (rev 5375)
+++ trunk/dirmngr/dirmngr_ldap.c 2010-07-24 13:33:03 UTC (rev 5376)
@@ -171,18 +171,17 @@
char *p;
int only_search_timeout = 0;
-#ifdef HAVE_W32_SYSTEM
- /* Yeah, right. Sigh. */
-#error FIXME
- _setmode (_fileno (stdout), _O_BINARY);
-#endif
-
set_strusage (my_strusage);
log_set_prefix ("dirmngr_ldap", JNLIB_LOG_WITH_PREFIX);
- /* Setup I18N. */
+ /* Setup I18N and common subsystems. */
i18n_init();
+ init_common_subsystems (&argc, &argv);
+
+ es_set_binary (es_stdout);
+
+
/* LDAP defaults */
opt.timeout.tv_sec = DEFAULT_LDAP_TIMEOUT;
opt.timeout.tv_usec = 0;
More information about the Gnupg-commits
mailing list