Varnish plugin: add a default instance name if none defined in config.
authorMarc Fournier <marc.fournier@camptocamp.com>
Wed, 16 Jun 2010 16:53:27 +0000 (18:53 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Wed, 16 Jun 2010 17:07:41 +0000 (19:07 +0200)
src/varnish.c

index 6716231..2325312 100644 (file)
@@ -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));