aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog5
-rw-r--r--common/estream.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index ce6817470..4dd266e0f 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,5 +1,8 @@
2010-04-20 Werner Koch <[email protected]>
+ * estream.c (es_deinit): New.
+ (es_init_do): Intll atexit handler to flush all streams.
+
* Makefile.am (common_sources): Add gettime.h.
2010-04-20 Marcus Brinkmann <[email protected]>
@@ -16,7 +19,7 @@
2010-04-15 Werner Koch <[email protected]>
- * util.h: Factor time related fucntions out to ...
+ * util.h: Factor time related functions out to ...
* gettime.h: New.
(gnupg_copy_time): Move to ...
* gettime.c (gnupg_copy_time): New.
diff --git a/common/estream.c b/common/estream.c
index 75d5ad694..47ff94ff2 100644
--- a/common/estream.c
+++ b/common/estream.c
@@ -423,6 +423,14 @@ es_pth_write (int fd, const void *buffer, size_t size)
+static void
+es_deinit (void)
+{
+ /* Flush all streams. */
+ es_fflush (NULL);
+}
+
+
/*
* Initialization.
*/
@@ -430,17 +438,20 @@ es_pth_write (int fd, const void *buffer, size_t size)
static int
es_init_do (void)
{
-#ifdef HAVE_PTH
static int initialized;
if (!initialized)
{
+#ifdef HAVE_PTH
if (!pth_init () && errno != EPERM )
return -1;
if (pth_mutex_init (&estream_list_lock))
initialized = 1;
- }
+#else
+ initialized = 1;
#endif
+ atexit (es_deinit);
+ }
return 0;
}