xymon

Check-in [874f40d6fd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge fixes from 4.3.10 up to rev 7140 git-svn-id: http://svn.code.sf.net/p/xymon/code/trunk@7141 44351d6e-118b-4698-b696-ce33095ecaa4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | master
Files: files | file ages | folders
SHA3-256: 874f40d6fdcd92bad4cb6744e0404ec11823bcba390727f124c3831268c6b067
User & Date: storner@users.sf.net 2012-08-01 12:24:55
Context
2012-08-01
12:27
xymoncfg: Merge rev 7126 (add -c and -s options) git-svn-id: http://svn.code.sf.net/p/xymon/code/trunk@7142 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 94e74e0ec3 user: storner@users.sf.net tags: trunk, master
12:24
Merge fixes from 4.3.10 up to rev 7140 git-svn-id: http://svn.code.sf.net/p/xymon/code/trunk@7141 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 874f40d6fd user: storner@users.sf.net tags: trunk, master
2012-07-28
06:29
showgraph: Rev7128 from 4.3.10: Missing check for failure to access $XYMONTMP directory could cause a crash. git-svn-id: http://svn.code.sf.net/p/xymon/code/trunk@7129 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: e707c7996f user: storner@users.sf.net tags: trunk, master
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to build/Makefile.Darwin.

4
5
6
7
8
9
10




11


12
13
14
15
16
17
18
19
20
21
22
23
24
OSDEF = -DDarwin

# NETLIBS: You may need to add -lresolv or similar to pick up network libraries
NETLIBS =

# Compile flags for normal build
CC = gcc




CFLAGS = -g -O -Wall -Wno-unused -D_REENTRANT -DBIND_8_COMPAT=1 $(LFSDEF) $(OSDEF)



# Compile flags for debugging
# CFLAGS = -g -DDEBUG -D_REENTRANT -DBIND_8_COMPAT=1 $(LFSDEF) $(OSDEF)

# Extra environment settings for runtime stuff.
# E.g. RUNTIMEDEFS="LD_LIBRARY_PATH=\"/opt/lib\"" to use 
# runtime libraries located in /opt/lib
RUNTIMEDEFS = 

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mail"








>
>
>
>
|
>
>













4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
OSDEF = -DDarwin

# NETLIBS: You may need to add -lresolv or similar to pick up network libraries
NETLIBS =

# Compile flags for normal build
CC = gcc
GCCVER := $(shell gcc -dumpversion|cut -d. -f1)
ifeq ($(GCCVER),4)
   CFLAGS = -g -O -Wall -Wno-unused -Wno-pointer-sign -D_REENTRANT -DBIND_8_COMPAT=1 $(LFSDEF) $(OSDEF)
else
   CFLAGS = -g -O -Wall -Wno-unused -D_REENTRANT -DBIND_8_COMPAT=1 $(LFSDEF) $(OSDEF)
endif


# Compile flags for debugging
# CFLAGS = -g -DDEBUG -D_REENTRANT -DBIND_8_COMPAT=1 $(LFSDEF) $(OSDEF)

# Extra environment settings for runtime stuff.
# E.g. RUNTIMEDEFS="LD_LIBRARY_PATH=\"/opt/lib\"" to use 
# runtime libraries located in /opt/lib
RUNTIMEDEFS = 

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mail"

Changes to build/Makefile.FreeBSD.

3
4
5
6
7
8
9




10



11
12
13
14
15
16
17
18
19
OSDEF = -DBSD

# NETLIBS: None needed
NETLIBS =

# Compile flags for normal build
CC = gcc




CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)



RPATH = "-Wl,--rpath,"

# Compile flags for debugging
# CFLAGS = -g -DDEBUG -Wall -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mail"








>
>
>
>
|
>
>
>









3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
OSDEF = -DBSD

# NETLIBS: None needed
NETLIBS =

# Compile flags for normal build
CC = gcc
GCCVER := $(shell gcc -dumpversion|cut -d. -f1)
ifeq ($(GCCVER),4)
	CFLAGS = -g -O2 -Wall -Wno-unused -Wno-pointer-sign -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)
else
	CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)
endif


RPATH = "-Wl,--rpath,"

# Compile flags for debugging
# CFLAGS = -g -DDEBUG -Wall -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mail"

Changes to build/Makefile.HP-UX.

13
14
15
16
17
18
19




20


21
22
23
24
25
26
27
28
# will typically show up when compiling the "xymonnet/xymonnet.c" where it bombs with
#   xymonnet.c: In function 'send_rpcinfo_results':
#   xymonnet.c:1794: warning: assignment makes pointer from integer without a cast
#   xymonnet.c:1801: error: dereferencing pointer to incomplete type
#   xymonnet.c:1813: error: dereferencing pointer to incomplete type
#   xymonnet.c:1818: error: dereferencing pointer to incomplete type
# If that happens, try adding -DBROKEN_HPUX_NETDB at the end of the CFLAGS line below. 




CFLAGS = -g -O -D_REENTRANT  $(LFSDEF) $(OSDEF)



# Compile flags for debugging
# CFLAGS = -g -DDEBUG -D_REENTRANT $(LFSDEF) $(OSDEF)

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mailx"








>
>
>
>
|
>
>








13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# will typically show up when compiling the "xymonnet/xymonnet.c" where it bombs with
#   xymonnet.c: In function 'send_rpcinfo_results':
#   xymonnet.c:1794: warning: assignment makes pointer from integer without a cast
#   xymonnet.c:1801: error: dereferencing pointer to incomplete type
#   xymonnet.c:1813: error: dereferencing pointer to incomplete type
#   xymonnet.c:1818: error: dereferencing pointer to incomplete type
# If that happens, try adding -DBROKEN_HPUX_NETDB at the end of the CFLAGS line below. 
GCCVER := $(shell gcc -dumpversion|cut -d. -f1)
ifeq ($(GCCVER),4)
   CFLAGS = -Wno-unused -Wno-pointer-sign -g -O -D_REENTRANT  $(LFSDEF) $(OSDEF)
else
   CFLAGS = -g -O -D_REENTRANT  $(LFSDEF) $(OSDEF)
endif


# Compile flags for debugging
# CFLAGS = -g -DDEBUG -D_REENTRANT $(LFSDEF) $(OSDEF)

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mailx"

Changes to build/Makefile.NetBSD.

3
4
5
6
7
8
9
10
11






12
13

14
15
16
17
18
19
20
21
22
23
#
OSDEF = -DBSD

# NETLIBS: None needed
NETLIBS =
#
# Compile flags for normal build
CC= gcc
PKGDIR?=/usr/pkg






CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT $(LFSDEF) $(OSDEF) \
       -I${PKGDIR}/include -L${PKGDIR}/lib, -Wl,--rpath=${PKGDIR}/lib

RPATH = "-Wl,--rpath,"

# Compile flags for debugging
# CFLAGS = -g -DDEBUG -Wall -D_REENTRANT $(LFSDEF) $(OSDEF) \
       -I${PKGDIR}/include -L${PKGDIR}/lib, -Wl,--rpath=${PKGDIR}/lib

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mail"








<

>
>
>
>
>
>
|

>










3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#
OSDEF = -DBSD

# NETLIBS: None needed
NETLIBS =
#
# Compile flags for normal build

PKGDIR?=/usr/pkg
CC= gcc
GCCVER := $(shell gcc -dumpversion|cut -d. -f1)
ifeq ($(GCCVER),4)
   CFLAGS = -g -O2 -Wall -Wno-unused -Wno-pointer-sign -D_REENTRANT $(LFSDEF) $(OSDEF) \
       -I${PKGDIR}/include -L${PKGDIR}/lib, -Wl,--rpath=${PKGDIR}/lib
else
   CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT $(LFSDEF) $(OSDEF) \
       -I${PKGDIR}/include -L${PKGDIR}/lib, -Wl,--rpath=${PKGDIR}/lib
endif
RPATH = "-Wl,--rpath,"

# Compile flags for debugging
# CFLAGS = -g -DDEBUG -Wall -D_REENTRANT $(LFSDEF) $(OSDEF) \
       -I${PKGDIR}/include -L${PKGDIR}/lib, -Wl,--rpath=${PKGDIR}/lib

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mail"

Changes to build/Makefile.OpenBSD.

3
4
5
6
7
8
9




10


11
12
13
14
15
16
17
18
19
20
OSDEF = -DBSD

# NETLIBS: None needed
NETLIBS =

# Compile flags for normal build
CC = gcc




CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)


# According to reports, this does not work on OpenBSD
# RPATH = "-Wl,--rpath,"

# Compile flags for debugging
# CFLAGS = -g -DDEBUG -Wall -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mail"








>
>
>
>
|
>
>










3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
OSDEF = -DBSD

# NETLIBS: None needed
NETLIBS =

# Compile flags for normal build
CC = gcc
GCCVER := $(shell gcc -dumpversion|cut -d. -f1)
ifeq ($(GCCVER),4)
	CFLAGS = -g -O2 -Wall -Wno-unused -Wno-pointer-sign -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)
else
	CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)
endif
#
# According to reports, this does not work on OpenBSD
# RPATH = "-Wl,--rpath,"

# Compile flags for debugging
# CFLAGS = -g -DDEBUG -Wall -D_REENTRANT -I/usr/local/include -L/usr/local/lib $(LFSDEF) $(OSDEF)

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mail"

Changes to build/Makefile.SCO_SV.

3
4
5
6
7
8
9




10

11
12
13
14
15
16
17
18
OSDEF = -DSCO_SV

# SCO_SV need this
NETLIBS = -lsocket -lnsl

# Compile flags for normal build
CC = gcc




CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT $(LFSDEF) $(OSDEF)


# Compile flags for debugging
# CFLAGS = -g -DDEBUG -Wall -D_REENTRANT $(LFSDEF) $(OSDEF)

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mailx"








>
>
>
>
|
>








3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
OSDEF = -DSCO_SV

# SCO_SV need this
NETLIBS = -lsocket -lnsl

# Compile flags for normal build
CC = gcc
GCCVER := $(shell gcc -dumpversion|cut -d. -f1)
ifeq ($(GCCVER),4)
   CFLAGS = -g -O2 -Wall -Wno-unused -Wno-pointer-sign -D_REENTRANT $(LFSDEF) $(OSDEF)
else
   CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT $(LFSDEF) $(OSDEF)
endif

# Compile flags for debugging
# CFLAGS = -g -DDEBUG -Wall -D_REENTRANT $(LFSDEF) $(OSDEF)

# Mail program: This must support "CMD -s SUBJECT ADDRESS" to send out a mail with a subject
# Typically, this will be "mail" or "mailx"
MAILPROGRAM="mailx"

Changes to build/Makefile.SunOS.

3
4
5
6
7
8
9




10

11
12
13
14
15
16
17
OSDEF = -DSunOS

# Solaris need this
NETLIBS = -lresolv -lsocket -lnsl

# Compile flags for normal build
CC = gcc




CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT $(LFSDEF) $(OSDEF)


# This guesswork doesnt work on a lot of systems.
# Better have a run-time issue that can easily be fixed with "crle"
# or by setting LD_LIBRARY_PATH, than a build-time problem.
#LDTYPE := $(shell ld -V 2>&1|head -1|cut -d' ' -f1)
#ifeq ($(LDTYPE),GNU)
#   RPATH=-Wl,--rpath,







>
>
>
>
|
>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
OSDEF = -DSunOS

# Solaris need this
NETLIBS = -lresolv -lsocket -lnsl

# Compile flags for normal build
CC = gcc
GCCVER := $(shell gcc -dumpversion|cut -d. -f1)
ifeq ($(GCCVER),4)
   CFLAGS = -g -O2 -Wall -Wno-unused -Wno-pointer-sign -D_REENTRANT $(LFSDEF) $(OSDEF)
else
   CFLAGS = -g -O2 -Wall -Wno-unused -D_REENTRANT $(LFSDEF) $(OSDEF)
endif

# This guesswork doesnt work on a lot of systems.
# Better have a run-time issue that can easily be fixed with "crle"
# or by setting LD_LIBRARY_PATH, than a build-time problem.
#LDTYPE := $(shell ld -V 2>&1|head -1|cut -d' ' -f1)
#ifeq ($(LDTYPE),GNU)
#   RPATH=-Wl,--rpath,

Changes to build/rrd.sh.

97
98
99
100
101
102
103






104
105
106
107
108
109
110
		# Could be that we need -lz for RRD
		PNGLIB="$PNGLIB $ZLIB"
	fi
	OS=`uname -s | sed -e's@/@_@g'` RRDLIB="$LIBOPT" PNGLIB="$PNGLIB" $MAKE -f Makefile.test-rrd test-link 2>/dev/null
	if test $? -ne 0; then
		# Could be that we need -lm for RRD
		PNGLIB="$PNGLIB -lm"






	fi
	OS=`uname -s | sed -e's@/@_@g'` RRDLIB="$LIBOPT" PNGLIB="$PNGLIB" $MAKE -f Makefile.test-rrd test-link 2>/dev/null
	if test $? -eq 0; then
		echo "Linking with RRDtool works OK"
		if test "$PNGLIB" != ""; then
			echo "Linking RRD needs extra library: $PNGLIB"
		fi







>
>
>
>
>
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
		# Could be that we need -lz for RRD
		PNGLIB="$PNGLIB $ZLIB"
	fi
	OS=`uname -s | sed -e's@/@_@g'` RRDLIB="$LIBOPT" PNGLIB="$PNGLIB" $MAKE -f Makefile.test-rrd test-link 2>/dev/null
	if test $? -ne 0; then
		# Could be that we need -lm for RRD
		PNGLIB="$PNGLIB -lm"
	fi
	OS=`uname -s | sed -e's@/@_@g'` RRDLIB="$LIBOPT" PNGLIB="$PNGLIB" $MAKE -f Makefile.test-rrd test-link 2>/dev/null
	if test $? -ne 0; then
		# Could be that we need -L/usr/X11R6/lib (OpenBSD)
		LIBOPT="$LIBOPT -L/usr/X11R6/lib"
		RRDLIB="$RRDLIB -L/usr/X11R6/lib"
	fi
	OS=`uname -s | sed -e's@/@_@g'` RRDLIB="$LIBOPT" PNGLIB="$PNGLIB" $MAKE -f Makefile.test-rrd test-link 2>/dev/null
	if test $? -eq 0; then
		echo "Linking with RRDtool works OK"
		if test "$PNGLIB" != ""; then
			echo "Linking RRD needs extra library: $PNGLIB"
		fi

Changes to build/test-lber.c.

1
2
3
4

5
6
7
8
#include <lber.h>

int main(int argc, char **argv) {
	BerElement *dummy;


	dummy = ber_init(NULL);
	return 0;
}




>

|


1
2
3
4
5
6
7
8
9
#include <lber.h>

int main(int argc, char **argv) {
	BerElement *dummy;
	char *foo = "bar";

	dummy = ber_init(ber_bvstrdup(foo));
	return 0;
}

Changes to client/logfetch.c.

932
933
934
935
936
937
938





939
940
941
942
943
944
945
946
947
948
949
950
			struct timezone tz;
			struct tm *tm;
			char timestr[50];

			gettimeofday(&tv, &tz);
			printf("epoch: %ld.%06ld\n", (long int)tv.tv_sec, (long int)tv.tv_usec);






			tm = localtime(&tv.tv_sec);
			strftime(timestr, sizeof(timestr), "local: %Y-%m-%d %H:%M:%S %Z", tm);
			printf("%s\n", timestr);

			tm = gmtime(&tv.tv_sec);
			strftime(timestr, sizeof(timestr), "UTC: %Y-%m-%d %H:%M:%S %Z", tm);
			printf("%s\n", timestr);
			return 0;
		}
		else if (i == 1) cfgfn = argv[i];
		else if (i == 2) statfn = argv[i];
	}







>
>
>
>
>
|



|







932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
			struct timezone tz;
			struct tm *tm;
			char timestr[50];

			gettimeofday(&tv, &tz);
			printf("epoch: %ld.%06ld\n", (long int)tv.tv_sec, (long int)tv.tv_usec);

			/*
			 * OpenBSD mistakenly has struct timeval members defined as "long",
			 * but requires localtime and gmtime to have a "time_t *" argument.
			 * Figures ...
			 */
			tm = localtime((time_t *)&tv.tv_sec);
			strftime(timestr, sizeof(timestr), "local: %Y-%m-%d %H:%M:%S %Z", tm);
			printf("%s\n", timestr);

			tm = gmtime((time_t *)&tv.tv_sec);
			strftime(timestr, sizeof(timestr), "UTC: %Y-%m-%d %H:%M:%S %Z", tm);
			printf("%s\n", timestr);
			return 0;
		}
		else if (i == 1) cfgfn = argv[i];
		else if (i == 2) statfn = argv[i];
	}

Changes to configure.server.

498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
    echo "DORRD = yes"                   >>Makefile
fi
echo "#"                                 >>Makefile
echo "# OpenSSL settings"                >>Makefile
if test "$ENABLESSL" = "y"
then
    echo "SSLFLAGS = $SSLFLAGS"          >>Makefile
    if test "$SSLINC" != ""; then
	echo "SSLINCDIR = -I$SSLINC"     >>Makefile
    fi
    if test "$OSSLLIB" != ""; then
	echo "SSLLIBS = -L$OSSLLIB -lssl -lcrypto" >>Makefile
	echo "RPATHVAL += ${OSSLLIB}"    >>Makefile
    else
	echo "SSLLIBS = -lssl -lcrypto"  >>Makefile
    fi







|
|







498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
    echo "DORRD = yes"                   >>Makefile
fi
echo "#"                                 >>Makefile
echo "# OpenSSL settings"                >>Makefile
if test "$ENABLESSL" = "y"
then
    echo "SSLFLAGS = $SSLFLAGS"          >>Makefile
    if test "$OSSLINC" != ""; then
	echo "SSLINCDIR = -I$OSSLINC"    >>Makefile
    fi
    if test "$OSSLLIB" != ""; then
	echo "SSLLIBS = -L$OSSLLIB -lssl -lcrypto" >>Makefile
	echo "RPATHVAL += ${OSSLLIB}"    >>Makefile
    else
	echo "SSLLIBS = -lssl -lcrypto"  >>Makefile
    fi

Changes to include/libxymon.h.

7
8
9
10
11
12
13

14
15
16
17
18
19
20
/* version 2. See the file "COPYING" for details.                             */
/*                                                                            */
/*----------------------------------------------------------------------------*/

#ifndef __LIBXYMON_H__
#define __LIBXYMON_H__


#include <stdio.h>
#include <time.h>

typedef struct htnames_t {
	char *name;
	struct htnames_t *next;
} htnames_t;







>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* version 2. See the file "COPYING" for details.                             */
/*                                                                            */
/*----------------------------------------------------------------------------*/

#ifndef __LIBXYMON_H__
#define __LIBXYMON_H__

#include <stddef.h>
#include <stdio.h>
#include <time.h>

typedef struct htnames_t {
	char *name;
	struct htnames_t *next;
} htnames_t;

Changes to lib/errormsg.c.

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

		MEMDEFINE(timestr);

		if (!debugfd) debugfd = stdout;

		strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S",
			 localtime(&now));
		fprintf(debugfd, "%d %s ", (int)getpid(), timestr);

		va_start(args, fmt);
		vfprintf(debugfd, fmt, args);
		va_end(args);
		fflush(debugfd);

		MEMUNDEFINE(timestr);
................................................................................
	if (tracefd) {
		char timestr[40];
		time_t now = getcurrenttime(NULL);

		MEMDEFINE(timestr);

		strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S", localtime(&now));
		fprintf(tracefd, "%08u %s ", (unsigned int)getpid(), timestr);

		va_start(args, fmt);
		vfprintf(tracefd, fmt, args);
		va_end(args);
		fflush(tracefd);

		MEMUNDEFINE(timestr);







|







 







|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

		MEMDEFINE(timestr);

		if (!debugfd) debugfd = stdout;

		strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S",
			 localtime(&now));
		fprintf(debugfd, "%lu %s ", (unsigned long)getpid(), timestr);

		va_start(args, fmt);
		vfprintf(debugfd, fmt, args);
		va_end(args);
		fflush(debugfd);

		MEMUNDEFINE(timestr);
................................................................................
	if (tracefd) {
		char timestr[40];
		time_t now = getcurrenttime(NULL);

		MEMDEFINE(timestr);

		strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S", localtime(&now));
		fprintf(tracefd, "%08lu %s ", (unsigned long)getpid(), timestr);

		va_start(args, fmt);
		vfprintf(tracefd, fmt, args);
		va_end(args);
		fflush(tracefd);

		MEMUNDEFINE(timestr);

Changes to web/report.c.

245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
...
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
	 * might provide.
	 */
	if (xgetenv("XYMONGEN")) sprintf(xymongencmd, "%s", xgetenv("XYMONGEN"));
	else sprintf(xymongencmd, "%s/bin/xymongen", xgetenv("XYMONHOME"));

	snprintf(xymongentimeopt, sizeof(xymongentimeopt)-1,"--reportopts=%u:%u:1:%s", (unsigned int)starttime, (unsigned int)endtime, style);

	sprintf(dirid, "%u-%u", (unsigned int)getpid(), (unsigned int)getcurrenttime(NULL));
	if (!csvoutput) {
		sprintf(outdir, "%s/%s", xgetenv("XYMONREPDIR"), dirid);
		mkdir(outdir, 0755);
		xymongen_argv[newargi++] = outdir;
		sprintf(xymonwebenv, "XYMONWEB=%s/%s", xgetenv("XYMONREPURL"), dirid);
		putenv(xymonwebenv);
	}
................................................................................
		xymongen_argv[newargi++] = csvdelimopt;
	}

	xymongen_argv[newargi++] = NULL;

	if (usemultipart) {
		/* Output the "please wait for report ... " thing */
		snprintf(htmldelim, sizeof(htmldelim)-1, "xymonrep-%u-%u", (int)getpid(), (unsigned int)getcurrenttime(NULL));
		printf("Content-type: multipart/mixed;boundary=%s\n", htmldelim);
		printf("\n");
		printf("--%s\n", htmldelim);
		printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));

		/* It's ok with these hardcoded values, as they are not used for this page */
		sethostenv("", "", "", colorname(COL_BLUE), NULL);







|







 







|







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
...
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
	 * might provide.
	 */
	if (xgetenv("XYMONGEN")) sprintf(xymongencmd, "%s", xgetenv("XYMONGEN"));
	else sprintf(xymongencmd, "%s/bin/xymongen", xgetenv("XYMONHOME"));

	snprintf(xymongentimeopt, sizeof(xymongentimeopt)-1,"--reportopts=%u:%u:1:%s", (unsigned int)starttime, (unsigned int)endtime, style);

	sprintf(dirid, "%lu-%u", (unsigned long)getpid(), (unsigned int)getcurrenttime(NULL));
	if (!csvoutput) {
		sprintf(outdir, "%s/%s", xgetenv("XYMONREPDIR"), dirid);
		mkdir(outdir, 0755);
		xymongen_argv[newargi++] = outdir;
		sprintf(xymonwebenv, "XYMONWEB=%s/%s", xgetenv("XYMONREPURL"), dirid);
		putenv(xymonwebenv);
	}
................................................................................
		xymongen_argv[newargi++] = csvdelimopt;
	}

	xymongen_argv[newargi++] = NULL;

	if (usemultipart) {
		/* Output the "please wait for report ... " thing */
		snprintf(htmldelim, sizeof(htmldelim)-1, "xymonrep-%lu-%u", (unsigned long)getpid(), (unsigned int)getcurrenttime(NULL));
		printf("Content-type: multipart/mixed;boundary=%s\n", htmldelim);
		printf("\n");
		printf("--%s\n", htmldelim);
		printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));

		/* It's ok with these hardcoded values, as they are not used for this page */
		sethostenv("", "", "", colorname(COL_BLUE), NULL);

Changes to web/reportlog.c.

136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
		errormsg("Cannot open history file");
	}

	color = parse_historyfile(fd, &repinfo, hostname, service, st, end, 0, reportwarnlevel, reportgreenlevel, reportwarnstops, reporttime);
	fclose(fd);

	textrepfn = (char *)malloc(1024 + strlen(hostname) + strlen(service));
	sprintf(textrepfn, "avail-%s-%s-%u-%u.txt", hostname, service, (unsigned int)getcurrenttime(NULL), (int)getpid());
	textrepfullfn = (char *)malloc(1024 + strlen(xgetenv("XYMONREPDIR")) + strlen(textrepfn));
	sprintf(textrepfullfn, "%s/%s", xgetenv("XYMONREPDIR"), textrepfn);
	textrepurl = (char *)malloc(1024 + strlen(xgetenv("XYMONREPURL")) + strlen(textrepfn));
	sprintf(textrepurl, "%s/%s", xgetenv("XYMONREPURL"), textrepfn);
	textrep = fopen(textrepfullfn, "w");

	/* Now generate the webpage */







|







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
		errormsg("Cannot open history file");
	}

	color = parse_historyfile(fd, &repinfo, hostname, service, st, end, 0, reportwarnlevel, reportgreenlevel, reportwarnstops, reporttime);
	fclose(fd);

	textrepfn = (char *)malloc(1024 + strlen(hostname) + strlen(service));
	sprintf(textrepfn, "avail-%s-%s-%u-%lu.txt", hostname, service, (unsigned int)getcurrenttime(NULL), (unsigned long)getpid());
	textrepfullfn = (char *)malloc(1024 + strlen(xgetenv("XYMONREPDIR")) + strlen(textrepfn));
	sprintf(textrepfullfn, "%s/%s", xgetenv("XYMONREPDIR"), textrepfn);
	textrepurl = (char *)malloc(1024 + strlen(xgetenv("XYMONREPURL")) + strlen(textrepfn));
	sprintf(textrepurl, "%s/%s", xgetenv("XYMONREPURL"), textrepfn);
	textrep = fopen(textrepfullfn, "w");

	/* Now generate the webpage */

Changes to web/snapshot.c.

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
	 * need to have option parsing done first.
	 */
	if (xgetenv("XYMONGEN")) sprintf(xymongencmd, "%s", xgetenv("XYMONGEN"));
	else sprintf(xymongencmd, "%s/bin/xymongen", xgetenv("XYMONHOME"));

	snprintf(xymongentimeopt, sizeof(xymongentimeopt), "--snapshot=%u", (unsigned int)starttime);

	sprintf(dirid, "%u-%u", (unsigned int)getpid(), (unsigned int)getcurrenttime(NULL));
	sprintf(outdir, "%s/%s", xgetenv("XYMONSNAPDIR"), dirid);
	if (mkdir(outdir, 0755) == -1) errormsg("Cannot create output directory");

	sprintf(xymonwebenv, "XYMONWEB=%s/%s", xgetenv("XYMONSNAPURL"), dirid);
	putenv(xymonwebenv);

	if (usemultipart) {
		/* Output the "please wait for report ... " thing */
		snprintf(htmldelim, sizeof(htmldelim)-1, "xymonrep-%u-%u", (int)getpid(), (unsigned int)getcurrenttime(NULL));
		printf("Content-type: multipart/mixed;boundary=%s\n", htmldelim);
		printf("\n");
		printf("%s\n", htmldelim);
		printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));

		/* It's ok with these hardcoded values, as they are not used for this page */
		sethostenv("", "", "", colorname(COL_BLUE), NULL);







|








|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
	 * need to have option parsing done first.
	 */
	if (xgetenv("XYMONGEN")) sprintf(xymongencmd, "%s", xgetenv("XYMONGEN"));
	else sprintf(xymongencmd, "%s/bin/xymongen", xgetenv("XYMONHOME"));

	snprintf(xymongentimeopt, sizeof(xymongentimeopt), "--snapshot=%u", (unsigned int)starttime);

	sprintf(dirid, "%lu-%u", (unsigned long)getpid(), (unsigned int)getcurrenttime(NULL));
	sprintf(outdir, "%s/%s", xgetenv("XYMONSNAPDIR"), dirid);
	if (mkdir(outdir, 0755) == -1) errormsg("Cannot create output directory");

	sprintf(xymonwebenv, "XYMONWEB=%s/%s", xgetenv("XYMONSNAPURL"), dirid);
	putenv(xymonwebenv);

	if (usemultipart) {
		/* Output the "please wait for report ... " thing */
		snprintf(htmldelim, sizeof(htmldelim)-1, "xymonrep-%lu-%u", (unsigned long)getpid(), (unsigned int)getcurrenttime(NULL));
		printf("Content-type: multipart/mixed;boundary=%s\n", htmldelim);
		printf("\n");
		printf("%s\n", htmldelim);
		printf("Content-type: %s\n\n", xgetenv("HTMLCONTENTTYPE"));

		/* It's ok with these hardcoded values, as they are not used for this page */
		sethostenv("", "", "", colorname(COL_BLUE), NULL);

Changes to xymond/xymond.c.

5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
		setsid();
	}

	/* Save PID */
	{
		FILE *fd = fopen(pidfn, "w");
		if (fd) {
			if (fprintf(fd, "%d\n", (int)getpid()) <= 0) {
				errprintf("Error writing PID file %s: %s\n", pidfn, strerror(errno));
			}
			fclose(fd);
		}
		else {
			errprintf("Cannot open PID file %s: %s\n", pidfn, strerror(errno));
		}







|







5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
		setsid();
	}

	/* Save PID */
	{
		FILE *fd = fopen(pidfn, "w");
		if (fd) {
			if (fprintf(fd, "%lu\n", (unsigned long)getpid()) <= 0) {
				errprintf("Error writing PID file %s: %s\n", pidfn, strerror(errno));
			}
			fclose(fd);
		}
		else {
			errprintf("Cannot open PID file %s: %s\n", pidfn, strerror(errno));
		}

Changes to xymond/xymond_history.c.

152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
		}
		xfree(savelist);
	}

	{
		FILE *pidfd = fopen(pidfn, "w");
		if (pidfd) {
			fprintf(pidfd, "%d\n", getpid());
			fclose(pidfd);
		}
	}

	sprintf(alleventsfn, "%s/allevents", histdir);
	if (save_allevents) {
		alleventsfd = fopen(alleventsfn, "a");







|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
		}
		xfree(savelist);
	}

	{
		FILE *pidfd = fopen(pidfn, "w");
		if (pidfd) {
			fprintf(pidfd, "%lu\n", (unsigned long)getpid());
			fclose(pidfd);
		}
	}

	sprintf(alleventsfn, "%s/allevents", histdir);
	if (save_allevents) {
		alleventsfd = fopen(alleventsfn, "a");

Changes to xymond/xymond_rrd.c.

238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
	sigaction(SIGCHLD, &sa, NULL);
	sigaction(SIGTERM, &sa, NULL);
	sigaction(SIGINT, &sa, NULL);
	signal(SIGPIPE, SIG_DFL);

	/* Setup the control socket that receives cache-flush commands */
	memset(&ctlsockaddr, 0, sizeof(ctlsockaddr));
	sprintf(ctlsockaddr.sun_path, "%s/rrdctl.%d", xgetenv("XYMONTMP"), getpid());
	unlink(ctlsockaddr.sun_path);     /* In case it was accidentally left behind */
	ctlsockaddr.sun_family = AF_UNIX;
	ctlsocket = socket(AF_UNIX, SOCK_DGRAM, 0);
	if (ctlsocket == -1) {
		errprintf("Cannot create cache-control socket (%s)\n", strerror(errno));
		return 1;
	}







|







238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
	sigaction(SIGCHLD, &sa, NULL);
	sigaction(SIGTERM, &sa, NULL);
	sigaction(SIGINT, &sa, NULL);
	signal(SIGPIPE, SIG_DFL);

	/* Setup the control socket that receives cache-flush commands */
	memset(&ctlsockaddr, 0, sizeof(ctlsockaddr));
	sprintf(ctlsockaddr.sun_path, "%s/rrdctl.%lu", xgetenv("XYMONTMP"), (unsigned long)getpid());
	unlink(ctlsockaddr.sun_path);     /* In case it was accidentally left behind */
	ctlsockaddr.sun_family = AF_UNIX;
	ctlsocket = socket(AF_UNIX, SOCK_DGRAM, 0);
	if (ctlsocket == -1) {
		errprintf("Cannot create cache-control socket (%s)\n", strerror(errno));
		return 1;
	}