summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b589096)
raw | patch | inline | side by side (parent: b589096)
author | Florian Forster <octo@collectd.org> | |
Mon, 25 Jul 2016 11:39:37 +0000 (13:39 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Mon, 25 Jul 2016 11:42:16 +0000 (13:42 +0200) |
Fixes: #1665
src/libcollectdclient/network_buffer.c | patch | blob | history | |
src/network.c | patch | blob | history |
index 61c7c22e2d7ab963a2d98977f8c0c3747ad18723..ee6857a4d45755368a38f602ec75ff653db18c3e 100644 (file)
#if HAVE_LIBGCRYPT
# if GCRYPT_VERSION_NUMBER < 0x010600
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ if (gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
+ return (0);
# endif
if (!gcry_check_version (GCRYPT_VERSION))
return (0);
- gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0);
+ if (!gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0))
+ return (0);
+
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
result = 1;
diff --git a/src/network.c b/src/network.c
index 5c7761d36faa0d0cdc03fb53bb65ae1ed7e388d6..b347f4a52fefc0416d2ebcf8bb7e472e641476a0 100644 (file)
--- a/src/network.c
+++ b/src/network.c
#if HAVE_LIBGCRYPT
static void network_init_gcrypt (void) /* {{{ */
{
+ gcry_error_t err;
+
/* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
* Because you can't know in a library whether another library has
* already initialized the library */
*
* tl;dr: keep all these gry_* statements in this exact order please. */
# if GCRYPT_VERSION_NUMBER < 0x010600
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ if (err)
+ {
+ ERROR ("network plugin: gcry_control (GCRYCTL_SET_THREAD_CBS) failed: %s", gcry_strerror (err));
+ abort ();
+ }
# endif
+
gcry_check_version (NULL);
- gcry_control (GCRYCTL_INIT_SECMEM, 32768);
+
+ err = gcry_control (GCRYCTL_INIT_SECMEM, 32768);
+ if (err)
+ {
+ ERROR ("network plugin: gcry_control (GCRYCTL_SET_THREAD_CBS) failed: %s", gcry_strerror (err));
+ abort ();
+ }
+
gcry_control (GCRYCTL_INITIALIZATION_FINISHED);
} /* }}} void network_init_gcrypt */