[hobbit] Antwort: Re: [hobbit] bb-histlog.sh

Henrik Stoerner henrik at hswn.dk
Sun Aug 6 23:29:05 CEST 2006


Hi,

There's one thing I still need to check, but I think this patch might
solve your problem. Could you try applying it and see if it works better
with this?

If you're running the original RC version, it's probably best if you
download the current "all-in-one" patch and apply that; you'll find it
at http://www.hswn.dk/hobbitsw/betapatches/


Regards,
Henrik

-------------- next part --------------
--- web/hobbitsvc.c	2006/06/14 12:30:30	1.71
+++ web/hobbitsvc.c	2006/08/06 21:23:55
@@ -193,7 +193,8 @@
 				struct stat st;
 				fstat(fileno(fd), &st);
 				log = (char *)malloc(st.st_size + 1);
-				fread(log, 1, st.st_size, fd);
+				n = fread(log, 1, st.st_size, fd);
+				if (n >= 0) *(log+n) = '\0'; else *log = '\0';
 				fclose(fd);
 			}
 		}
@@ -336,7 +337,8 @@
 			return 1;
 		}
 		log = (char *)malloc(st.st_size+1);
-		read(fd, log, st.st_size);
+		n = read(fd, log, st.st_size);
+		if (n >= 0) *(log+n) = '\0'; else *log = '\0';
 		close(fd);
 
 		p = strchr(log, '\n'); 


More information about the Xymon mailing list