From: Marc Fournier Date: Wed, 16 Jun 2010 16:53:27 +0000 (+0200) Subject: Varnish plugin: add a default instance name if none defined in config. X-Git-Tag: collectd-5.0.0-beta0~99^2~3 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0af747df59d57fc972b27e98c175f26d873d7814;p=collectd.git Varnish plugin: add a default instance name if none defined in config. --- diff --git a/src/varnish.c b/src/varnish.c index 6716231f..23253127 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -164,12 +164,13 @@ static int varnish_submit (const char *plugin_instance, /* {{{ */ sstrncpy(vl.plugin, "varnish", sizeof(vl.plugin)); - if (plugin_instance != NULL) { - sstrncpy (vl.plugin_instance, plugin_instance, + if (plugin_instance == NULL) + plugin_instance = "default"; + + sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); - strncat(vl.plugin_instance, "-", 1); - strncat(vl.plugin_instance, category, sizeof(category)); - } + strncat(vl.plugin_instance, "-", 1); + strncat(vl.plugin_instance, category, sizeof(category)); sstrncpy(vl.type, type, sizeof(vl.type));