@cryptotaxi247 / netdata-1 / commits / 46e2e3c25

support for names with slash

Costa Tsaousis (ktsaou) committed Mar 30, 2014 at 01:01 UTC 46e2e3c25ac6d6c8d0d43345f624e3b5251365e5
1 file changed +4 -1
netdata.c
+4 -1
@@ -368,6 +368,7 @@ pthread_mutex_t root_mutex = PTHREAD_MUTEX_INITIALIZER;
368 RRD_STATS *rrd_stats_create(const char *id, const char *name, unsigned long entries, const char *title, const char *vtitle, const char *type)
369 {
370 RRD_STATS *st = NULL;
371 + char *p;
372
373 debug(D_RRD_STATS, "Creating RRD_STATS for '%s'.", name);
374
@@ -386,6 +387,9 @@ RRD_STATS *rrd_stats_create(const char *id, const char *name, unsigned long entr
387
388 strncpy(st->name, name, RRD_STATS_NAME_MAX);
389 st->name[RRD_STATS_NAME_MAX] = '\0';
390 + while((p = strchr(st->name, '/'))) *p = '_';
391 + while((p = strchr(st->name, '?'))) *p = '_';
392 + while((p = strchr(st->name, '&'))) *p = '_';
393
394 strncpy(st->title, title, RRD_STATS_NAME_MAX);
395 st->title[RRD_STATS_NAME_MAX] = '\0';
@@ -397,7 +401,6 @@ RRD_STATS *rrd_stats_create(const char *id, const char *name, unsigned long entr
401 st->type[RRD_STATS_NAME_MAX] = '\0';
402
403 // check if there is a name for it in the environment
400 - char *p;
404 sprintf(st->envtitle, "NETDATA_TITLE_%s", st->id);
405 while((p = strchr(st->envtitle, '.'))) *p = '_';
406 while((p = strchr(st->envtitle, '-'))) *p = '_';