apachetop dumps core on latest current / RELENG_5_2
Jun Kuriyama
kuriyama at imgsrc.co.jp
Sun Feb 22 06:58:23 PST 2004
From malloc(3) manpage, return value of calloc(0, 1) may be not null
depending on J option. So we need to test whether items for calloc()
is 0 or not.
When I tried this port before, it works without problem, but It dumps
core when I built this port today (pthread related?).
I make a patch to fix this problem. Is it okay to check this in?
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/sysutils/apachetop/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile 6 Feb 2004 13:12:21 -0000 1.7
+++ Makefile 22 Feb 2004 13:56:32 -0000
@@ -7,7 +7,7 @@
PORTNAME= apachetop
PORTVERSION= 0.9
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= http://clueful.shagged.org/apachetop/files/
DISTNAME= ${PORTNAME}-${PORTVERSION}
Index: files/patch-display.cc
===================================================================
RCS file: files/patch-display.cc
diff -N files/patch-display.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-display.cc 22 Feb 2004 13:54:37 -0000
@@ -0,0 +1,17 @@
+--- src/display.cc.orig Sun Feb 22 22:53:52 2004
++++ src/display.cc Sun Feb 22 22:54:16 2004
+@@ -238,8 +238,12 @@
+ * I'm fairly sure, realistically, it'll never get high enough to be
+ * a problem, so uInt should be ok */
+ if (items) free(items); /* get rid of the last one */
+- items = (struct itemlist *)
+- calloc((unsigned int)items_size, sizeof(itemlist));
++ if (items_size == 0) {
++ items = NULL;
++ } else {
++ items = (struct itemlist *)
++ calloc((unsigned int)items_size, sizeof(itemlist));
++ }
+
+ /* another thread may change the contents of cf while we're running,
+ * and it would be undesirable to have most of this change on us, so
--
Jun Kuriyama <kuriyama at imgsrc.co.jp> // IMG SRC, Inc.
<kuriyama at FreeBSD.org> // FreeBSD Project
More information about the freebsd-ports
mailing list