summaryrefslogtreecommitdiffstats
path: root/scd/scdaemon.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de>2012-01-02 22:15:00 +0100
committerMarcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de>2012-01-02 22:15:00 +0100
commita2d9e48fcca6cfc2dfadef6dbd3579a30314676b (patch)
treef379d06676984a965c6daacbc6fed119dca14f4f /scd/scdaemon.c
parentUse the longest key ID available when talking to a HKP server. (diff)
downloadgnupg2-a2d9e48fcca6cfc2dfadef6dbd3579a30314676b.tar.xz
gnupg2-a2d9e48fcca6cfc2dfadef6dbd3579a30314676b.zip
Only set gcrypt thread callback for older version of gcrypt.
* agent/gpg-agent.c, dirmngr/dirmngr.c, g13/g13.c, scd/scdaemon.c (USE_GCRY_THREAD_CBS): New macro, defined if GCRY_THREAD_OPTION_VERSION is 0. (fixed_gcry_pth_init) [!USE_GCRY_THREAD_CBS]: Don't define. (main) [!USE_GCRY_THREAD_CBS]: Do not install thread callbacks.
Diffstat (limited to 'scd/scdaemon.c')
-rw-r--r--scd/scdaemon.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index c8905d4f0..128ecc31d 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -208,12 +208,18 @@ static void handle_connections (int listen_fd);
/* Pth wrapper function definitions. */
ASSUAN_SYSTEM_PTH_IMPL;
+#if defined(GCRY_THREAD_OPTION_VERSION) && (GCRY_THREAD_OPTION_VERSION == 0)
+#define USE_GCRY_THREAD_CBS 1
+#endif
+
+#ifdef USE_GCRY_THREAD_CBS
GCRY_THREAD_OPTION_PTH_IMPL;
+
static int fixed_gcry_pth_init (void)
{
return pth_self ()? 0 : (pth_init () == FALSE) ? errno : 0;
}
-
+#endif
static char *
@@ -413,6 +419,7 @@ main (int argc, char **argv )
/* Libgcrypt requires us to register the threading model first.
Note that this will also do the pth_init. */
+#ifdef USE_GCRY_THREAD_CBS
gcry_threads_pth.init = fixed_gcry_pth_init;
err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
if (err)
@@ -420,6 +427,7 @@ main (int argc, char **argv )
log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
gpg_strerror (err));
}
+#endif
/* Check that the libraries are suitable. Do it here because
the option parsing may need services of the library */