Merge branch 'collectd-5.5' into collectd-5.6
authorFlorian Forster <octo@collectd.org>
Tue, 6 Sep 2016 06:08:01 +0000 (08:08 +0200)
committerFlorian Forster <octo@collectd.org>
Tue, 6 Sep 2016 06:08:01 +0000 (08:08 +0200)
src/daemon/plugin.c
src/network.c

index 1bee8cd..c6efc3f 100644 (file)
@@ -2401,7 +2401,7 @@ int plugin_dispatch_multivalue (value_list_t const *template, /* {{{ */
                case DS_TYPE_GAUGE:
                        vl->values[0].gauge = va_arg (ap, gauge_t);
                        if (store_percentage)
-                               vl->values[0].gauge *= sum ? (100.0 / sum) : 0;
+                               vl->values[0].gauge *= sum ? (100.0 / sum) : NAN;
                        break;
                case DS_TYPE_ABSOLUTE:
                        vl->values[0].absolute = va_arg (ap, absolute_t);
index 51c0757..9a0f429 100644 (file)
@@ -2085,33 +2085,28 @@ static int sockent_init_crypto (sockent_t *se) /* {{{ */
        }
        else /* (se->type == SOCKENT_TYPE_SERVER) */
        {
-               if (se->data.server.security_level > SECURITY_LEVEL_NONE)
+               if ((se->data.server.security_level > SECURITY_LEVEL_NONE)
+                               && (se->data.server.auth_file == NULL))
+               {
+                       ERROR ("network plugin: Server socket with security requested, "
+                                       "but no \"AuthFile\" is configured.");
+                       return (-1);
+               }
+               if (se->data.server.auth_file != NULL)
                {
                        if (network_init_gcrypt () < 0)
                        {
-                               ERROR ("network plugin: Cannot configure server socket with "
-                                               "security: Failed to initialize crypto library.");
+                               ERROR ("network plugin: Cannot configure server socket with security: "
+                                               "Failed to initialize crypto library.");
                                return (-1);
                        }
 
-                       if (se->data.server.auth_file == NULL)
-                       {
-                               ERROR ("network plugin: Server socket with "
-                                               "security requested, but no "
-                                               "password file is configured.");
-                               return (-1);
-                       }
-               }
-               if (se->data.server.auth_file != NULL)
-               {
                        se->data.server.userdb = fbh_create (se->data.server.auth_file);
                        if (se->data.server.userdb == NULL)
                        {
-                               ERROR ("network plugin: Reading password file "
-                                               "`%s' failed.",
+                               ERROR ("network plugin: Reading password file \"%s\" failed.",
                                                se->data.server.auth_file);
-                               if (se->data.server.security_level > SECURITY_LEVEL_NONE)
-                                       return (-1);
+                               return (-1);
                        }
                }
        }
@@ -3449,14 +3444,6 @@ static int network_init (void)
                return (0);
        have_init = 1;
 
-#if HAVE_LIBGCRYPT
-       if (network_init_gcrypt () < 0)
-       {
-               ERROR ("network plugin: Failed to initialize crypto library.");
-               return (-1);
-       }
-#endif
-
        if (network_config_stats)
                plugin_register_read ("network", network_stats_read);