From: Fabien Wernli Date: Mon, 28 Nov 2011 09:46:18 +0000 (+0100) Subject: fix Host config being ignored X-Git-Tag: collectd-5.0.5~4^2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8e4720f3f09d21b7cf46acda5a5295101b2ece41;p=collectd.git fix Host config being ignored Change-Id: I8a109818d8a821e2f3e0660fbb6ba1843279fcc2 Signed-off-by: Florian Forster --- diff --git a/src/curl_xml.c b/src/curl_xml.c index 052ea1e6..599e18f7 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -419,7 +419,7 @@ static int cx_handle_instance_xpath (xmlXPathContextPtr xpath_ctx, /* {{{ */ return (0); } /* }}} int cx_handle_instance_xpath */ -static int cx_handle_base_xpath (char *plugin_instance, /* {{{ */ +static int cx_handle_base_xpath (char *plugin_instance, char *host, /* {{{ */ xmlXPathContextPtr xpath_ctx, const data_set_t *ds, char *base_xpath, cx_xpath_t *xpath) { @@ -461,7 +461,7 @@ static int cx_handle_base_xpath (char *plugin_instance, /* {{{ */ vl.values_len = ds->ds_num; sstrncpy (vl.type, xpath->type, sizeof (vl.type)); sstrncpy (vl.plugin, "curl_xml", sizeof (vl.plugin)); - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.host, (host == NULL) ? hostname_g : host, sizeof (vl.host)); if (plugin_instance != NULL) sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); @@ -504,7 +504,7 @@ static int cx_handle_parsed_xml(xmlDocPtr doc, /* {{{ */ ds = plugin_get_ds (xpath->type); if ( (cx_check_type(ds, xpath) == 0) && - (cx_handle_base_xpath(db->instance, xpath_ctx, ds, le->key, xpath) == 0) ) + (cx_handle_base_xpath(db->instance, db->host, xpath_ctx, ds, le->key, xpath) == 0) ) status = 0; /* we got atleast one success */ le = le->next;