Code

curl_xml plugin: Allow arbitrarily long callback names.
authorFlorian Forster <octo@collectd.org>
Sun, 12 May 2013 10:21:07 +0000 (12:21 +0200)
committerFlorian Forster <octo@collectd.org>
Sun, 12 May 2013 10:21:07 +0000 (12:21 +0200)
Fixes issue #286.

src/curl_xml.c

index 0b4130473f4e3359dc9cbb66059831ac09386a34..5adaf067a157e44220655adb79855c6fee0d3b26 100644 (file)
@@ -966,7 +966,7 @@ static int cx_config_add_url (oconfig_item_t *ci) /* {{{ */
   if (status == 0)
   {
     user_data_t ud;
-    char cb_name[DATA_MAX_NAME_LEN];
+    char *cb_name;
 
     if (db->instance == NULL)
       db->instance = strdup("default");
@@ -978,11 +978,10 @@ static int cx_config_add_url (oconfig_item_t *ci) /* {{{ */
     ud.data = (void *) db;
     ud.free_func = cx_free;
 
-    ssnprintf (cb_name, sizeof (cb_name), "curl_xml-%s-%s",
-               db->instance, db->url);
-
-    plugin_register_complex_read (/* group = */ NULL, cb_name, cx_read,
+    cb_name = ssnprintf_alloc ("curl_xml-%s-%s", db->instance, db->url);
+    plugin_register_complex_read (/* group = */ "curl_xml", cb_name, cx_read,
                                   /* interval = */ NULL, &ud);
+    sfree (cb_name);
   }
   else
   {