#endif
while(likely(1)) {
+ if(unlikely(netdata_exit)) break;
+
FILE *fp = mypopen(cd->cmd, &cd->pid);
if(unlikely(!fp)) {
error("Cannot popen(\"%s\", \"r\").", cd->cmd);
uint32_t hash;
while(likely(fgets(line, PLUGINSD_LINE_MAX, fp) != NULL)) {
- if(netdata_exit) break;
+ if(unlikely(netdata_exit)) break;
line[PLUGINSD_LINE_MAX] = '\0';
st = NULL;
}
else if(likely(hash == CHART_HASH && !strcmp(s, "CHART"))) {
+ int noname = 0;
st = NULL;
+ if((words[1]) != NULL && (words[2]) != NULL && strcmp(words[1], words[2]) == 0)
+ noname = 1;
+
char *type = words[1];
char *id = NULL;
if(likely(type)) {
int chart_type = RRDSET_TYPE_LINE;
if(unlikely(chart)) chart_type = rrdset_type_id(chart);
- if(unlikely(!name || !*name)) name = NULL;
+ if(unlikely(noname || !name || !*name || strcasecmp(name, "NULL") == 0 || strcasecmp(name, "(NULL)") == 0)) name = NULL;
if(unlikely(!family || !*family)) family = id;
if(unlikely(!category || !*category)) category = type;
cd->pid = 0;
cd->enabled = 0;
cd->obsolete = 1;
+ pthread_exit(NULL);
return NULL;
}
}
cd->obsolete = 1;
+ pthread_exit(NULL);
return NULL;
}
if(scan_frequency < 1) scan_frequency = 1;
while(likely(1)) {
- if(netdata_exit) break;
+ if(unlikely(netdata_exit)) break;
dir = opendir(dir_name);
if(unlikely(!dir)) {
error("Cannot open directory '%s'.", dir_name);
+ pthread_exit(NULL);
return NULL;
}
while(likely((file = readdir(dir)))) {
- if(netdata_exit) break;
+ if(unlikely(netdata_exit)) break;
debug(D_PLUGINSD, "PLUGINSD: Examining file '%s'", file->d_name);
sleep((unsigned int) scan_frequency);
}
+ pthread_exit(NULL);
return NULL;
}