X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_curl_stats.c;h=09856599b090672f2f05fff356a6e905d7d30fdc;hb=7f07c55bac640c7a50d516248a3152235a14af59;hp=2a426646f86905a2b8695dfd55f4a6b095d86e59;hpb=eec0cd9ca51c5c132ed09fc4699c02f3bd12d748;p=collectd.git diff --git a/src/utils_curl_stats.c b/src/utils_curl_stats.c index 2a426646..09856599 100644 --- a/src/utils_curl_stats.c +++ b/src/utils_curl_stats.c @@ -182,7 +182,7 @@ curl_stats_t *curl_stats_from_config(oconfig_item_t *ci) { oconfig_item_t *c = ci->children + i; size_t field; - _Bool enabled = 0; + bool enabled = 0; for (field = 0; field < STATIC_ARRAY_SIZE(field_specs); ++field) { if (!strcasecmp(c->key, field_specs[field].config_key)) @@ -218,15 +218,15 @@ int curl_stats_dispatch(curl_stats_t *s, CURL *curl, const char *hostname, if (s == NULL) return 0; - if ((curl == NULL) || (hostname == NULL) || (plugin == NULL)) { + if ((curl == NULL) || (plugin == NULL)) { ERROR("curl stats: dispatch() called with missing arguments " - "(curl=%p; hostname=%s; plugin=%s)", - curl, hostname == NULL ? "" : hostname, - plugin == NULL ? "" : plugin); + "(curl=%p; plugin=%s)", + curl, plugin == NULL ? "" : plugin); return -1; } - sstrncpy(vl.host, hostname, sizeof(vl.host)); + if (hostname != NULL) + sstrncpy(vl.host, hostname, sizeof(vl.host)); sstrncpy(vl.plugin, plugin, sizeof(vl.plugin)); if (plugin_instance != NULL) sstrncpy(vl.plugin_instance, plugin_instance, sizeof(vl.plugin_instance));