[Xymon] core dump

Stef Coene stef.coene at docum.org
Mon Jan 13 11:02:12 CET 2014


Hi,

I have installed the client but I moved it to an other directory.
I tried to set XYMONHOME to this new directory, but this causes xymonlaunch to 
crash with a buffer overvlow.  The rest of the commands are running fine.
This is the code from ./common/xymonlaunch.c:

/* Find config */
if (!config) {
   if (stat("/etc/tasks.cfg", &st) != -1) config = strdup("/etc/tasks.cfg");
   else if (stat("/etc/xymon/tasks.cfg", &st) != -1) config = 
strdup("/etc/xymon/tasks.cfg");
   else if (stat("/etc/xymon-client/clientlaunch.cfg", &st) != -1) config = 
strdup("/etc/xymon-client/clientlaunch.cfg");
   else if (xgetenv("XYMONHOME")) {
      char *pf = NULL;
      sprintf(pf, "%s/etc/tasks.cfg", xgetenv("XYMONHOME"));
      if (pf && stat(pf, &st) != -1) config = strdup(pf);
   }  
   if (config) dbgprintf("Using config file: %s\n", config);
}  

I fixed it like this (line 546).  I also added an extra if statement so the 
script also tries to use clientlaunch.cfg:

/* Find config */
if (!config) {
   if (stat("/etc/tasks.cfg", &st) != -1) config = strdup("/etc/tasks.cfg");
   else if (stat("/etc/xymon/tasks.cfg", &st) != -1) config = 
strdup("/etc/xymon/tasks.cfg");
   else if (stat("/etc/xymon-client/clientlaunch.cfg", &st) != -1) config = 
strdup("/etc/xymon-client/clientlaunch.cfg");
   else if (xgetenv("XYMONHOME")) {
      char pf[1024] ;
      sprintf(pf, "%s/etc/tasks.cfg", xgetenv("XYMONHOME"));
      if (pf && stat(pf, &st) != -1) {
         config = strdup(pf);
      } else {
         sprintf(pf, "%s/etc/clientlaunch.cfg", xgetenv("XYMONHOME"));
         config = strdup(pf);
     }
   }

I also have a problem with this line from file common/xymoncmd.c:
    sprintf(envfn, "%s/etc/xymonserver.cfg", xgetenv("XYMONHOME"));

I want to run xymoncmd without setting XYMONHOME.  So it has to use XYMONHOME 
from compile time, but that's not working.  In the Makefile I set XYMONHOME to 
a directory but during the compile, /client is added.


Stef



More information about the Xymon mailing list