aboutsummaryrefslogtreecommitdiffstats
path: root/common/estream.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2010-04-21 16:26:17 +0000
committerWerner Koch <[email protected]>2010-04-21 16:26:17 +0000
commita1412b05debe693e6aabaf2c2c337bc33f7dfd41 (patch)
tree214dc8928b73aaa385d69eaa180164318ff0bb93 /common/estream.c
parentDisable card support for now (diff)
downloadgnupg-a1412b05debe693e6aabaf2c2c337bc33f7dfd41.tar.gz
gnupg-a1412b05debe693e6aabaf2c2c337bc33f7dfd41.zip
More changes on the way to remove secring.gpg.
Diffstat (limited to 'common/estream.c')
-rw-r--r--common/estream.c15
1 files changed, 13 insertions, 2 deletions
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;
}