Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Oct 1995 18:15:02 +0300 (MSK)
From:      =?KOI8-R?Q?=E1=CE=C4=D2=C5=CA_=FE=C5=D2=CE=CF=D7?= (aka Andrey A. Chernov, Black Mage) <ache@astral.msk.su>
To:        Kai.Vorma@hut.fi, current@freebsd.org
Subject:   Re: tail dumps core
Message-ID:  <flsteUmWjY@ache.dialup.demos.ru>
In-Reply-To: <199510100647.IAA13033@lk-hp-4.hut.fi>; from Kai Vorma at Tue, 10 Oct 1995 08:47:22 %2B0200
References:  <199510100647.IAA13033@lk-hp-4.hut.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <199510100647.IAA13033@lk-hp-4.hut.fi> Kai Vorma writes:

>"cat file | tail" dumps core with the newest phk-malloc. This patch should
>help.

>*** read.c      Fri May 27 15:32:45 1994
>--- read.c.ok   Tue Oct 10 08:30:35 1995
>***************
>*** 142,148 ****
  
>        if ((lines = malloc(off * sizeof(*lines))) == NULL)
>                err(1, "%s", strerror(errno));
>! 
>        sp = NULL;
>        blen = cnt = recno = wrap = 0;
  
>--- 142,148 ----
  
>        if ((lines = malloc(off * sizeof(*lines))) == NULL)
>                err(1, "%s", strerror(errno));
>!       bzero(lines, off * sizeof(*lines));
>        sp = NULL;
>        blen = cnt = recno = wrap = 0;
  

>..vode

Why not use 'calloc' instead? bzero isn't portable way.
Theoretically 'calloc' can do some internal optimization of zeroing.

-- 
Andrey A. Chernov        : And I rest so composedly,  /Now, in my bed,
ache@astral.msk.su       : That any beholder  /Might fancy me dead -
FidoNet: 2:5020/230.3    : Might start at beholding me,  /Thinking me dead.
RELCOM Team,FreeBSD Team :         E.A.Poe         From "For Annie" 1849



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?flsteUmWjY>