Date: Sun, 22 Feb 2004 23:58:20 +0900 From: Jun Kuriyama <kuriyama@imgsrc.co.jp> To: esn@x123.info Cc: Jun Kuriyama <kuriyama@imgsrc.co.jp> Subject: apachetop dumps core on latest current / RELENG_5_2 Message-ID: <7mn07bjh4j.wl@black.imgsrc.co.jp>
next in thread | raw e-mail | index | archive | help
=46rom 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 @@ =20 PORTNAME=3D apachetop PORTVERSION=3D 0.9 -PORTREVISION=3D 1 +PORTREVISION=3D 2 CATEGORIES=3D sysutils MASTER_SITES=3D http://clueful.shagged.org/apachetop/files/ DISTNAME=3D ${PORTNAME}-${PORTVERSION} Index: files/patch-display.cc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D (struct itemlist *) +- calloc((unsigned int)items_size, sizeof(itemlist)); ++ if (items_size =3D=3D 0) { ++ items =3D NULL; ++ } else { ++ items =3D (struct itemlist *) ++ calloc((unsigned int)items_size, sizeof(itemlist)); ++ } + =09 + /* 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 --=20 Jun Kuriyama <kuriyama@imgsrc.co.jp> // IMG SRC, Inc. <kuriyama@FreeBSD.org> // FreeBSD Project
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7mn07bjh4j.wl>