Xymon Mailing List Archive search

hobbitd_larrd is crashing

list Henrik Størner
Sat, 10 Jun 2006 00:31:20 +0200
Message-Id: <user-ce2c2a8e2744@xymon.invalid>

On Fri, Jun 09, 2006 at 05:23:21PM -0500, Larry Barber wrote:
rrdtool performs as expected:

-bash-2.05b$ /usr/local/rrdtool-1.2.10/bin/rrdtool create /foo.rrd
DS:sec:GAUGE:600:0:U RRA:AVERAGE:0.5:1:576
ERROR: creating '/foo.rrd': Permission denied
OK, but I still think it is odd that it crashes while printing an
RRDtool error message.

What happens if you use this patch on top of the one you already
installed ?


Henrik

-------------- next part --------------
--- hobbitd/do_rrd.c.p1	2006-06-10 00:26:34.449750393 +0200
+++ hobbitd/do_rrd.c	2006-06-10 00:31:02.065972642 +0200
@@ -141,7 +141,14 @@
 		optind = opterr = 0; rrd_clear_error();
 		result = rrd_create(pcount, creparams);
 		if (result != 0) {
-			errprintf("RRD error creating %s: %s\n", filedir, rrd_get_error());
+			char *errmsg = rrd_get_error();
+			char errcopy[100];
• +			if (errmsg == NULL) errmsg = "Unknown rrd error";
+			strncpy(errcopy, errmsg, sizeof(errcopy)-1);
+			errcopy[sizeof(errcopy)-1] = '\0';
• +			errprintf("RRD error creating %s: %s\n", filedir, errcopy);
 			MEMUNDEFINE(filedir);
 			MEMUNDEFINE(rrdvalues); MEMUNDEFINE(rrdfn);
 			return 1;