From: Florian Forster Date: Mon, 25 Jul 2016 11:39:37 +0000 (+0200) Subject: network plugin, libcollectdclient: Check return value of gcry_control(). X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=19963420ec2ed9445cd21a009f284032f318aaa5;p=collectd.git network plugin, libcollectdclient: Check return value of gcry_control(). Fixes: #1665 (cherry picked from commit 8b4fed9940e02138b7e273e56863df03d1a39ef7) Conflicts: src/libcollectdclient/network_buffer.c src/network.c --- diff --git a/src/network.c b/src/network.c index c2d20bec..48d1bda6 100644 --- a/src/network.c +++ b/src/network.c @@ -494,6 +494,8 @@ static int network_dispatch_notification (notification_t *n) /* {{{ */ #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 */ @@ -507,9 +509,21 @@ static void network_init_gcrypt (void) /* {{{ */ * above doesn't count, as it doesn't implicitly initalize Libgcrypt. * * tl;dr: keep all these gry_* statements in this exact order please. */ - 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 (); + } 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 */