variable scope is before variable name
Costa Tsaousis (ktsaou) committed
Oct 17, 2017 at 01:35 UTC
69084696d5daa6c9b16861bc7b8dddde66fc4175
1 file changed
+11
-9
src/plugins_d.c
+11
-9
@@ -377,23 +377,25 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int
377
char *value = words[2];
378
int global = (st)?0:1;
379
380
- if(unlikely(!name || !*name)) {
381
- error("PLUGINSD: '%s' is requesting a VARIABLE on host '%s', without a variable name. Disabling it.", cd->fullfilename, host->hostname);
382
- enabled = 0;
383
- break;
384
- }
385
-
386
- if(value && *value) {
387
- if((strcmp(value, "GLOBAL") == 0 || strcmp(value, "HOST") == 0)) {
380
+ if(name && *name) {
381
+ if((strcmp(name, "GLOBAL") == 0 || strcmp(name, "HOST") == 0)) {
382
global = 1;
383
+ name = words[2];
384
value = words[3];
385
}
391
- else if((strcmp(value, "LOCAL") == 0 || strcmp(value, "CHART") == 0)) {
386
+ else if((strcmp(name, "LOCAL") == 0 || strcmp(name, "CHART") == 0)) {
387
global = 0;
388
+ name = words[2];
389
value = words[3];
390
}
391
}
392
393
+ if(unlikely(!name || !*name)) {
394
+ error("PLUGINSD: '%s' is requesting a VARIABLE on host '%s', without a variable name. Disabling it.", cd->fullfilename, host->hostname);
395
+ enabled = 0;
396
+ break;
397
+ }
398
+
399
if(unlikely(!value || !*value))
400
value = NULL;
401