X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fopenldap.c;h=e100aeed61bec89dd2e67a523827d64a230bfb75;hb=c76419c0cf983f1ecd3d36aa236cc4e3f9cff733;hp=066dabcd1e6e52a03bf7bb5bd265fb133e2cfa80;hpb=0a95b83f89a553be1ac2beae2003927e74230d23;p=collectd.git diff --git a/src/openldap.c b/src/openldap.c index 066dabcd..e100aeed 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -169,11 +169,7 @@ static void cldap_submit_value (const char *type, const char *type_instance, /* vl.values = &value; vl.values_len = 1; - if ((st->host == NULL) - || (strcmp ("", st->host) == 0) - || (strcmp ("localhost", st->host) == 0)) - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); - else + if ((st->host != NULL) && (strcmp ("localhost", st->host) != 0)) sstrncpy (vl.host, st->host, sizeof (vl.host)); sstrncpy (vl.plugin, "openldap", sizeof (vl.plugin)); @@ -192,17 +188,13 @@ static void cldap_submit_value (const char *type, const char *type_instance, /* static void cldap_submit_derive (const char *type, const char *type_instance, /* {{{ */ derive_t d, cldap_t *st) { - value_t v; - v.derive = d; - cldap_submit_value (type, type_instance, v, st); + cldap_submit_value (type, type_instance, (value_t) { .derive = d }, st); } /* }}} void cldap_submit_derive */ static void cldap_submit_gauge (const char *type, const char *type_instance, /* {{{ */ gauge_t g, cldap_t *st) { - value_t v; - v.gauge = g; - cldap_submit_value (type, type_instance, v, st); + cldap_submit_value (type, type_instance, (value_t) { .gauge = g }, st); } /* }}} void cldap_submit_gauge */ static int cldap_read_host (user_data_t *ud) /* {{{ */ @@ -575,7 +567,7 @@ static int cldap_config_add (oconfig_item_t *ci) /* {{{ */ } st->starttls = 0; - st->timeout = (long) (CDTIME_T_TO_MS(plugin_get_interval()) / 1000); + st->timeout = (long) CDTIME_T_TO_TIME_T(plugin_get_interval()); st->verifyhost = 1; st->version = LDAP_VERSION3;