Re: ps segfault

Andi Gutmans (andi@actcom.co.il)
Thu, 5 Dec 1996 16:36:00 +0200 (EET)


It fixed my problem. Works now. THanks,

Andi

On Thu, 5 Dec 1996, Raymund Will wrote:

>
> Pete Harlan writes:
> > > > we just noticed this "ps axf" causes a segmentation fault on 2.0.23 using
> > > > the procps-1.01 ...
> > >
> > > Doesn't do that here. Same versions used.
> Depends on, where it comes from... ;^)
>
> > It segfaults when the number of processes is greater than 64. (63?)
> > It's a bug in ps.
> Correct, it's an 'of-by-one' error -- try this one:
> == snip ==
> diff -ur procps-1.01/ps.c procps-1.01-ray/ps.c
> --- procps-1.01/ps.c Wed Jun 12 14:39:36 1996
> +++ procps-1.01-ray/ps.c Tue Oct 1 18:58:31 1996
> @@ -515,7 +515,7 @@
> node = (struct tree_node *)
> malloc(sizeof(struct tree_node) * maxnodes);
> }
> - if (nodes > maxnodes) {
> + if (nodes >= maxnodes) {
> maxnodes *= 2;
> node = (struct tree_node *)
> realloc(node, sizeof(struct tree_node) * maxnodes);
> == snip ==
>
> Regards,
> --
> Raymund Will ray@lst.de
>