X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnetwork.c;h=e8b45a33bb53f77613abb004e6f97ec6e09ccd80;hb=dff1246579ac6bea70331e560d2e1da0c7429b11;hp=3cf222744262796d4ce964cf3c76d4c690202d49;hpb=400596160704146845940d7d9c4f794c0d2ddc03;p=collectd.git diff --git a/src/network.c b/src/network.c index 3cf22274..e8b45a33 100644 --- a/src/network.c +++ b/src/network.c @@ -3306,7 +3306,6 @@ static int network_stats_read (void) /* {{{ */ vl.values = values; vl.values_len = 2; vl.time = 0; - vl.interval = interval_g; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "network", sizeof (vl.plugin)); @@ -3366,9 +3365,17 @@ static int network_init (void) have_init = 1; #if HAVE_LIBGCRYPT - gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); - gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0); - gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); + /* 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 + */ + if (!gcry_control (GCRYCTL_ANY_INITIALIZATION_P)) + { + gcry_check_version(NULL); /* before calling any other functions */ + gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); + gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); + } #endif if (network_config_stats != 0) @@ -3402,7 +3409,7 @@ static int network_init (void) if (dispatch_thread_running == 0) { int status; - status = pthread_create (&dispatch_thread_id, + status = plugin_thread_create (&dispatch_thread_id, NULL /* no attributes */, dispatch_thread, NULL /* no argument */); @@ -3422,7 +3429,7 @@ static int network_init (void) if (receive_thread_running == 0) { int status; - status = pthread_create (&receive_thread_id, + status = plugin_thread_create (&receive_thread_id, NULL /* no attributes */, receive_thread, NULL /* no argument */);