bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: cfengine2: syslog messages display the hostname inst


From: Andrew Stribblehill
Subject: Re: address@hidden: cfengine2: syslog messages display the hostname instead of the process name]
Date: Tue, 11 Feb 2003 10:19:27 +0000
User-agent: Mutt/1.4i

Quoting Mark Burgess <address@hidden> (2003-02-10 04:09:44 GMT):
> On 10 Feb, Andrew Stribblehill wrote:
> > This is reproducible on 2.0.5b1 too on Linux. Looks like the problem
> > is that VPREFIX changes over the duration of the process. openlog()
> > must record the char* that is the prefix parameter as a global
> > variable somewhere, and then syslog() just prints that each time,
> > even if it's changed.
> > 
> > If VPREFIX can't be stopped from changing, could we have a new
> > variable that doesn't mutate?

It appears that GetNameInfo overwrites VPREFIX with the hostname. I'm
convinced it shouldn't do this. The following patch changes this and
wires in 'cfexecd', 'cfenvd' and 'cfservd' to VPREFIX such that it's
defined before it's used :)

I need to know if this is something I shouldn't be doing, since I'll
be uploading it with the Debian package very shortly unless warned
against it.

diff -ruN cfengine-2.0.5b1-old/src/cfenvd.c cfengine-2.0.5b1/src/cfenvd.c
--- cfengine-2.0.5b1-old/src/cfenvd.c   2003-02-10 21:14:19.000000000 +0000
+++ cfengine-2.0.5b1/src/cfenvd.c       2003-02-10 21:15:40.000000000 +0000
@@ -210,6 +210,7 @@
  int c, i,j,k;
 
 umask(077);
+sprintf(VPREFIX,"cfenvd"); 
 openlog(VPREFIX,LOG_PID|LOG_NOWAIT|LOG_ODELAY,LOG_DAEMON);
 
 strcpy(CFLOCK,"cfenvd");
@@ -268,7 +269,6 @@
 
 LOGGING = true;                    /* Do output to syslog */
  
-sprintf(VPREFIX,"cfenvd:%s:",VUQNAME); 
 sprintf(VBUFF,"%s/test",WORKDIR);
 MakeDirectoriesFor(VBUFF,'y');
 strncpy(VLOCKDIR,WORKDIR,bufsize-1);
diff -ruN cfengine-2.0.5b1-old/src/cfexecd.c cfengine-2.0.5b1/src/cfexecd.c
--- cfengine-2.0.5b1-old/src/cfexecd.c  2003-02-10 21:14:19.000000000 +0000
+++ cfengine-2.0.5b1/src/cfexecd.c      2003-02-10 21:22:04.000000000 +0000
@@ -150,7 +150,8 @@
   int c;
 
 ld_library_path[0] = '\0';
-  
+
+sprintf(VPREFIX, "cfexecd"); 
 openlog(VPREFIX,LOG_PID|LOG_NOWAIT|LOG_ODELAY,LOG_DAEMON);
 
 while ((c=getopt_long(argc,argv,"L:d:f:vhpFV1g",CFDOPTIONS,&optindex)) != EOF)
diff -ruN cfengine-2.0.5b1-old/src/cfservd.c cfengine-2.0.5b1/src/cfservd.c
--- cfengine-2.0.5b1-old/src/cfservd.c  2003-02-10 21:14:19.000000000 +0000
+++ cfengine-2.0.5b1/src/cfservd.c      2003-02-10 21:21:36.000000000 +0000
@@ -175,6 +175,7 @@
   struct stat statbuf;
   int c;
 
+sprintf(VPREFIX, "cfservd");
 openlog(VPREFIX,LOG_PID|LOG_NOWAIT|LOG_ODELAY,LOG_DAEMON);
 strcpy(VINPUTFILE,CFD_INPUT);
 strcpy(CFLOCK,"cfservd");
diff -ruN cfengine-2.0.5b1-old/src/nameinfo.c cfengine-2.0.5b1/src/nameinfo.c
--- cfengine-2.0.5b1-old/src/nameinfo.c 2003-01-31 15:52:03.000000000 +0000
+++ cfengine-2.0.5b1/src/nameinfo.c     2003-02-10 21:20:54.000000000 +0000
@@ -122,8 +122,6 @@
 strcpy(sp,VSYSNAME.nodename);
 SetDomainName(sp);
 
-strcpy(VPREFIX,VSYSNAME.nodename);
-
 for (sp2=sp; *sp2 != '\0'; sp2++)  /* Truncate fully qualified name */
    {
    if (*sp2 == '.')


-- 
FAIR ISLE FAEROES
WEST OR SOUTHWEST 6 TO GALE 8, DECREASING 4 OR 5 IN FAIR ISLE.
SHOWERS. GOOD




reply via email to

[Prev in Thread] Current Thread [Next in Thread]