amqp, write_graphite and write_kafka plugins: Implement the "[Graphite]PreserveSepara...
[collectd.git] / src / apache.c
index 20a2a3c..7ccdb60 100644 (file)
@@ -244,7 +244,7 @@ static int config_add (oconfig_item_t *ci)
                ssnprintf (callback_name, sizeof (callback_name),
                                "apache/%s/%s",
                                (st->host != NULL) ? st->host : hostname_g,
-                               (st->name != NULL) ? st->name : "default"),
+                               (st->name != NULL) ? st->name : "default");
 
                status = plugin_register_complex_read (/* group = */ NULL,
                                /* name      = */ callback_name,
@@ -394,8 +394,8 @@ static void submit_value (const char *type, const char *type_instance,
        vl.values = &value;
        vl.values_len = 1;
 
-       sstrncpy (vl.host, (st->host != NULL) ? st->host : hostname_g,
-                       sizeof (vl.host));
+       if (st->host != NULL)
+               sstrncpy (vl.host, st->host, sizeof (vl.host));
 
        sstrncpy (vl.plugin, "apache", sizeof (vl.plugin));
        if (st->name != NULL)