Xymon Mailing List Archive search

Fix wrt advanced graph title

list W.J.M. Nelis
Mon, 28 Dec 2009 08:24:18 +0100
Message-Id: <user-abe110dd2a5b@xymon.invalid>

Hello,

if for a host the NAME directive is used in bb-hosts, and if there is a blank space in this name, and if for a test data is collected in an RRD, and if the title of the graph is generated by a user-supplied script, the latter script will fail as the parameters are not at the expected location. The modifications below in hobbitgraph.c seems to fix this problem.

Een gelukkig nieuwjaar gewenst,
  Wim Nelis.


[root at sodn035u web]# diff -u hobbitgraph.c.org hobbitgraph.c
--- hobbitgraph.c.org   2009-02-17 12:53:17.000000000 +0100
+++ hobbitgraph.c       2009-12-28 07:46:46.000000000 +0100
@@ -988,11 +988,11 @@
                FILE *pfd;
                char *p;
 -               pcmdlen = strlen(gdef->title+5) + strlen(displayname) + strlen(service) + strlen(glegend) + 5;
+               pcmdlen = strlen(gdef->title+5) + strlen(displayname) + strlen(service) + strlen(glegend) + 7;
                for (i=0; (i<rrddbcount); i++) pcmdlen += (strlen(rrddbs[i].rrdfn) + 3);
                 p = pcmd = (char *)malloc(pcmdlen+1);
-               p += sprintf(p, "%s %s %s \"%s\"", gdef->title+5, displayname, service, glegend);
+               p += sprintf(p, "%s \"%s\" %s \"%s\"", gdef->title+5, displayname, service, glegend);
                for (i=0; (i<rrddbcount); i++) {
                        if ((firstidx == -1) || ((i >= firstidx) && (i <= lastidx))) {
                                p += sprintf(p, " \"%s\"", rrddbs[i].rrdfn);


*******************************************************************************************************
The NLR disclaimer (http://www.nlr.nl/emaildisclaimer) is valid for NLR e-mail messages.
*******************************************************************************************************